@@ -34,6 +34,30 @@ void testIsOnTheBeat()
34
34
std::cout << " ." ;
35
35
}
36
36
37
+ void testFindPositionNearGivenTick ()
38
+ {
39
+ std::vector<Note> notes = {{768 , 0 , 0 }, {960 , 0 , 0 }, {1152 , 0 , 0 },
40
+ {1536 , 0 , 0 }, {1728 , 0 , 0 }, {1920 , 0 , 0 },
41
+ {2304 , 0 , 0 }, {2496 , 0 , 0 }, {2688 , 0 , 0 },
42
+ {3072 , 0 , 0 }, {3264 , 0 , 0 }};
43
+
44
+ assert (std::nullopt == FindPositionNearGivenTick (notes, 100 ));
45
+ assert (768 == FindPositionNearGivenTick (notes, 750 )->Position );
46
+ assert (1536 == FindPositionNearGivenTick (notes, 1500 )->Position );
47
+ assert (std::nullopt == FindPositionNearGivenTick (notes, 3200 ));
48
+
49
+ std::cout << " ." ;
50
+ }
51
+
52
+ void testCalculateScore ()
53
+ {
54
+ assert (0 == CalculateScore (750 , 100 ));
55
+ assert (1000 == CalculateScore (750 , 750 ));
56
+ assert (500 == CalculateScore (750 , 725 ));
57
+
58
+ std::cout << " ." ;
59
+ }
60
+
37
61
void testRoundUpToTheNearestMultiplier ()
38
62
{
39
63
assert (20 == RoundUpToTheNearestMultiplier (12 , 10 ));
@@ -74,6 +98,8 @@ int main()
74
98
testConvertTickToPosition ();
75
99
testConvertSecondsToTicks ();
76
100
testIsOnTheBeat ();
101
+ testFindPositionNearGivenTick ();
102
+ testCalculateScore ();
77
103
testRoundUpToTheNearestMultiplier ();
78
104
testGenerateAdjacentKeyPairs ();
79
105
testCalculateBeatBars ();
0 commit comments