Skip to content

Commit 789de1b

Browse files
committed
add: tests (taiko, fruits, mania, and convert)
1 parent ec87a88 commit 789de1b

4 files changed

Lines changed: 132 additions & 0 deletions

File tree

tests/test_fruits_calc.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from peace_performance_python.objects.calculator import Calculator
2+
from peace_performance_python.objects.beatmap import Beatmap
3+
import pytest
4+
from typing import Callable
5+
6+
from . import (
7+
join_beatmap,
8+
HITORIGOTO,
9+
MEI_FRUITS,
10+
)
11+
12+
13+
def _gb(file: str) -> Beatmap:
14+
return Beatmap(join_beatmap(file))
15+
16+
17+
@pytest.mark.fruits_pp
18+
def test_mei() -> None:
19+
b = _gb(MEI_FRUITS)
20+
21+
pp_ss = Calculator().calculate(b).pp
22+
assert pp_ss == 1036.869384765625
23+
24+
pp_95 = Calculator(acc=95).calculate(b).pp
25+
assert pp_95 == 782.4349975585938
26+
27+
28+
@pytest.mark.fruits_pp
29+
def test_std_hitorigoto_convert_fruits() -> None:
30+
b = _gb(HITORIGOTO)
31+
32+
pp_ss = Calculator(mode=2).calculate(b).pp
33+
assert pp_ss == 196.4501495361328
34+
35+
pp_95 = Calculator(mode=2, acc=95).calculate(b).pp
36+
assert pp_95 == 148.42703247070312

tests/test_mania_calc.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from peace_performance_python.objects.calculator import Calculator
2+
from peace_performance_python.objects.beatmap import Beatmap
3+
import pytest
4+
from typing import Callable
5+
6+
from . import (
7+
join_beatmap,
8+
HITORIGOTO,
9+
BLUE_ZENITH_MANIA,
10+
)
11+
12+
13+
def _gb(file: str) -> Beatmap:
14+
return Beatmap(join_beatmap(file))
15+
16+
17+
@pytest.mark.mania_pp
18+
def test_blue_zenith() -> None:
19+
b = _gb(BLUE_ZENITH_MANIA)
20+
21+
pp_ss = Calculator().calculate(b).pp
22+
assert pp_ss == 3686.19775390625
23+
24+
pp_95 = Calculator(score=950000).calculate(b).pp
25+
assert pp_95 == 3266.82568359375
26+
27+
28+
@pytest.mark.mania_pp
29+
def test_std_hitorigoto_convert_mania() -> None:
30+
b = _gb(HITORIGOTO)
31+
32+
pp_ss = Calculator(mode=3).calculate(b).pp
33+
assert pp_ss == 25.583507537841797
34+
35+
pp_95 = Calculator(mode=3, score=950000).calculate(b).pp
36+
assert pp_95 == 21.481416702270508

tests/test_std_calc.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from peace_performance_python.objects.calculator import Calculator
2+
from peace_performance_python.objects.beatmap import Beatmap
3+
import pytest
4+
from typing import Callable
5+
6+
from . import (
7+
join_beatmap,
8+
HITORIGOTO
9+
)
10+
11+
12+
def _gb(file: str) -> Beatmap:
13+
return Beatmap(join_beatmap(file))
14+
15+
16+
@pytest.mark.std_pp
17+
def test_hitorigoto() -> None:
18+
b = _gb(HITORIGOTO)
19+
20+
pp_ss = Calculator().calculate(b).pp
21+
assert pp_ss == 183.6759796142578
22+
23+
pp_95 = Calculator(acc=95).calculate(b).pp
24+
assert pp_95 == 122.74517822265625

tests/test_taiko_calc.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from peace_performance_python.objects.calculator import Calculator
2+
from peace_performance_python.objects.beatmap import Beatmap
3+
import pytest
4+
from typing import Callable
5+
6+
from . import (
7+
join_beatmap,
8+
HITORIGOTO,
9+
THE_BIG_BLACK_TAIKO,
10+
)
11+
12+
13+
def _gb(file: str) -> Beatmap:
14+
return Beatmap(join_beatmap(file))
15+
16+
17+
@pytest.mark.taiko_pp
18+
def test_the_big_black() -> None:
19+
b = _gb(THE_BIG_BLACK_TAIKO)
20+
21+
pp_ss = Calculator().calculate(b).pp
22+
assert pp_ss == 551.592041015625
23+
24+
pp_95 = Calculator(acc=95).calculate(b).pp
25+
assert pp_95 == 448.6329040527344
26+
27+
28+
@pytest.mark.taiko_pp
29+
def test_std_hitorigoto_convert_taiko() -> None:
30+
b = _gb(HITORIGOTO)
31+
32+
pp_ss = Calculator(mode=1).calculate(b).pp
33+
assert pp_ss == 112.30728149414062
34+
35+
pp_95 = Calculator(mode=1, acc=95).calculate(b).pp
36+
assert pp_95 == 58.653507232666016

0 commit comments

Comments
 (0)