Neale Pickett
·
2026-02-16
abc_test.go
1package layouts
2
3import "testing"
4
5func abcTest(t *testing.T, s string, n int8) {
6 if r := ABC2MIDI(s); r != n {
7 t.Errorf("ABC2MIDI(%#v): wanted %d, got %d", s, n, r)
8 }
9}
10
11func midiTest(t *testing.T, n int8, s string) {
12 if v := MIDI2ABC(n); v != s {
13 t.Errorf("MIDI2ABC(%d); wanted %#v, got %#v", n, s, v)
14 }
15}
16
17func bothTest(t *testing.T, s string, n int8) {
18 abcTest(t, s, n)
19 midiTest(t, n, s)
20}
21
22func TestABC(t *testing.T) {
23 abcTest(t, "C", 60)
24 abcTest(t, "D", 62)
25 abcTest(t, "E", 64)
26 abcTest(t, "F", 65)
27 abcTest(t, "G", 67)
28 abcTest(t, "A", 69)
29 abcTest(t, "B", 71)
30 abcTest(t, "c", 72)
31 abcTest(t, "d", 74)
32 abcTest(t, "e", 76)
33 abcTest(t, "f", 77)
34 abcTest(t, "g", 79)
35 abcTest(t, "a", 81)
36 abcTest(t, "b", 83)
37 abcTest(t, "c^", 73)
38 abcTest(t, "b_'", 94)
39 abcTest(t, "G^,,", 44)
40}