-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit tests for Note.oct and String.asNote
This should serve as a starting point for other unit tests.
- Loading branch information
Adam Spiers
committed
Oct 21, 2017
1 parent
86527bd
commit 2e16b88
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
TestStringExtVariousAsNote : UnitTest { | ||
setUp { | ||
} | ||
|
||
tearDown { | ||
} | ||
|
||
test_asNote { | ||
[ | ||
["B1", 47], | ||
["C2", 48], | ||
["C#2", 49], | ||
["B2", 59], | ||
["C3", 60], | ||
["C#3", 61], | ||
["B3", 71], | ||
].do { |pair| | ||
var in = pair[0], expected = pair[1]; | ||
var got = in.asNote; | ||
this.assertEquals(got.class, Note); | ||
this.assertEquals(got.midi, expected); | ||
}; | ||
} | ||
} | ||
|
||
// To test, use one of the following approaches: | ||
// | ||
// UnitTest.gui; | ||
// UnitTest.runTest("TestExtVariousAsNote:test_asNote"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
TestNote : UnitTest { | ||
setUp { | ||
} | ||
|
||
tearDown { | ||
} | ||
|
||
test_oct { | ||
[ | ||
["C3", 3], | ||
["Cb3", 2], | ||
["B#4", 5], | ||
].do { |pair| | ||
var in = pair[0], expected = pair[1]; | ||
var got = in.asNote; | ||
this.assertEquals(got.oct, expected); | ||
}; | ||
} | ||
} | ||
|
||
// To test, use one of the following approaches: | ||
// | ||
// UnitTest.gui; | ||
// UnitTest.runTestClassForClass(Note); | ||
// UnitTest.runTest("TestNote:test_oct"); |