-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtests.html
46 lines (36 loc) · 1.5 KB
/
tests.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<script src="metronome.js"></script>
<script src="tinytest.js"></script>
<script>
tests({
"Test we detect the correct place to beep in a bar": () => {
assertEquals(shouldBeep(4, 5), false);
},
"Test we detect the correct place to beep in a bar": () => {
assertEquals(shouldBeep(4, 4), true);
},
"Test we assign the correct text to the button": () => {
assertEquals(updateToggleButtonText(true), 'stop');
},
"Test we assign the correct text to the button": () => {
assertEquals(updateToggleButtonText(false), 'start');
},
"Test whole notes at 120 are converted to milliseconds correctly": () => {
assertEquals(bpmToMs(120, 1), 2000);
},
"Test half notes at 120 are converted to milliseconds correctly": () => {
assertEquals(bpmToMs(120, 2), 1000);
},
"Test quarter notes at 120 are converted to milliseconds correctly": () => {
assertEquals(bpmToMs(120, 4), 500);
},
"Test eigth notes at 120 are converted to milliseconds correctly": () => {
assertEquals(bpmToMs(120, 8), 250);
},
"Test sixteenth notes at 120 are converted to milliseconds correctly": () => {
assertEquals(bpmToMs(120, 16), 125);
},
"Test thirty-second notes at 120 are converted to milliseconds correctly": () => {
assertEquals(bpmToMs(120, 32), 62.5)
}
});
</script>