1
0
mirror of synced 2025-01-19 16:18:39 +01:00

Move #memo tests to a folder and add examples

This commit is contained in:
Stepland 2021-05-01 12:02:59 +02:00
parent abd5a3f3cf
commit a53442fdea
3 changed files with 76 additions and 5 deletions

View File

@ -0,0 +1,69 @@
from jubeatools.song import TapNote, LongNote, NotePosition
from fractions import Fraction
notes = {
TapNote(time=Fraction(0, 1), position=NotePosition(x=0, y=0)),
TapNote(time=Fraction(0, 1), position=NotePosition(x=0, y=1)),
TapNote(time=Fraction(0, 1), position=NotePosition(x=0, y=3)),
LongNote(
time=Fraction(0, 1),
position=NotePosition(x=1, y=0),
duration=Fraction(1, 16),
tail_tip=NotePosition(x=2, y=0),
),
TapNote(time=Fraction(0, 1), position=NotePosition(x=1, y=1)),
LongNote(
time=Fraction(0, 1),
position=NotePosition(x=1, y=2),
duration=Fraction(1, 3),
tail_tip=NotePosition(x=2, y=2),
),
LongNote(
time=Fraction(1, 8),
position=NotePosition(x=0, y=3),
duration=Fraction(1, 4),
tail_tip=NotePosition(x=2, y=3),
),
TapNote(time=Fraction(1, 4), position=NotePosition(x=0, y=0)),
TapNote(time=Fraction(5, 16), position=NotePosition(x=1, y=0)),
LongNote(
time=Fraction(1, 2),
position=NotePosition(x=0, y=0),
duration=Fraction(1, 16),
tail_tip=NotePosition(x=1, y=0),
),
LongNote(
time=Fraction(5, 8),
position=NotePosition(x=0, y=3),
duration=Fraction(1, 4),
tail_tip=NotePosition(x=1, y=3),
),
TapNote(time=Fraction(13, 16), position=NotePosition(x=0, y=0)),
LongNote(
time=Fraction(17, 16),
position=NotePosition(x=0, y=0),
duration=Fraction(1, 4),
tail_tip=NotePosition(x=1, y=0),
),
LongNote(
time=Fraction(25, 16),
position=NotePosition(x=0, y=0),
duration=Fraction(1, 4),
tail_tip=NotePosition(x=2, y=0),
),
TapNote(time=Fraction(33, 16), position=NotePosition(x=0, y=0)),
TapNote(time=Fraction(57, 8), position=NotePosition(x=1, y=1)),
TapNote(time=Fraction(59, 8), position=NotePosition(x=1, y=1)),
TapNote(time=Fraction(61, 8), position=NotePosition(x=1, y=1)),
TapNote(time=Fraction(63, 8), position=NotePosition(x=1, y=1)),
TapNote(time=Fraction(79, 8), position=NotePosition(x=1, y=1)),
TapNote(time=Fraction(187, 16), position=NotePosition(x=1, y=0)),
TapNote(time=Fraction(191, 16), position=NotePosition(x=1, y=0)),
LongNote(
time=Fraction(97, 8),
position=NotePosition(x=1, y=1),
duration=Fraction(1, 4),
tail_tip=NotePosition(x=2, y=1),
),
TapNote(time=Fraction(195, 16), position=NotePosition(x=1, y=0)),
}

View File

@ -1,9 +1,9 @@
from decimal import Decimal
from fractions import Fraction
from pathlib import Path
from typing import List, Union
from typing import Set, Union
from hypothesis import given
from hypothesis import given, example
from jubeatools.song import (
BeatsTime,
@ -18,13 +18,15 @@ from jubeatools.song import (
)
from jubeatools.testutils.strategies import NoteOption
from jubeatools.testutils.strategies import notes as notes_strat
from jubeatools.formats.jubeat_analyser.memo.dump import _dump_memo_chart
from jubeatools.formats.jubeat_analyser.memo.load import MemoParser
from ..memo.dump import _dump_memo_chart
from ..memo.load import MemoParser
from . import example1
@given(notes_strat(NoteOption.LONGS))
def test_many_notes(notes: List[Union[TapNote, LongNote]]) -> None:
@example(example1.notes)
def test_many_notes(notes: Set[Union[TapNote, LongNote]]) -> None:
timing = Timing(
events=[BPMEvent(BeatsTime(0), Decimal(120))], beat_zero_offset=SecondsTime(0)
)