From 21fd594041982dc503d79ebb793fc23ca72ffd24 Mon Sep 17 00:00:00 2001 From: Jules Kerssemakers Date: Tue, 2 Jan 2024 15:49:21 +0100 Subject: [PATCH] WIP: NoteMapperTest: Enharmonics; still fail. --- .../pianoli/melodies/NoteMapperTest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/src/test/java/com/nicobrailo/pianoli/melodies/NoteMapperTest.java b/app/src/test/java/com/nicobrailo/pianoli/melodies/NoteMapperTest.java index 37ab8fc..9efd64e 100644 --- a/app/src/test/java/com/nicobrailo/pianoli/melodies/NoteMapperTest.java +++ b/app/src/test/java/com/nicobrailo/pianoli/melodies/NoteMapperTest.java @@ -22,6 +22,37 @@ public void noteRangeLimits() { } + /** + * + * half-steps that don't have a black key in-between. + * + *

"Enharmonic equivalents" are different notations for the same note. + * "B#", or half-step up from B, is equal to a normal "C". + * The reasons for this are grounded in history and musical theory, but suffice to say: + * many things in notation become easier if the half-step modifiers #/b are always allowed, + * instead of forbidden on the notes missing their black-key. + *

+ *

+ * Further reading:

+ *

+ */ + @ParameterizedTest + @CsvSource({ + "B#,C", + "Cb,B", + "E#,F", + "Fb,E", + + }) + public void enharmonicEquivalantsAreEqual(String modifiedNote, String plainEquivalent) { + int modified = get_key_idx_from_note(modifiedNote); + int plain = get_key_idx_from_note(plainEquivalent); + assertEquals(plain, modified, + "Enharmonic equivalent notation should work should work"); + + } static List allNotesSource() { List octaves = List.of("1", "2");