diff options
| author | Jake Zerrer <him@jakezerrer.com> | 2025-11-12 14:20:57 -0500 |
|---|---|---|
| committer | Jake Zerrer <him@jakezerrer.com> | 2025-11-12 14:37:54 -0500 |
| commit | 2d751c6c89d6f95c568e4ce050ea63af0e1c3cc4 (patch) | |
| tree | 3b524e1cd0e87ba97c4dad7f10591f9c8908ce76 /src/unheard/midi_test.clj | |
| parent | 751a37a72c8d4e20b52f351c4562d84cc4d26e25 (diff) | |
Move test out of midi.clj
Diffstat (limited to 'src/unheard/midi_test.clj')
| -rw-r--r-- | src/unheard/midi_test.clj | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/unheard/midi_test.clj b/src/unheard/midi_test.clj new file mode 100644 index 0000000..cbf3d5a --- /dev/null +++ b/src/unheard/midi_test.clj @@ -0,0 +1,26 @@ +(ns unheard.midi-test + (:require [unheard.midi :as sut] + [hyperfiddle.rcf :refer [tests]]) + (:import [javax.sound.midi ShortMessage])) + +(defn test-msg [cmd ch d1 d2] + (ShortMessage. cmd ch d1 d2)) + +(tests "short-message->notes" + (let [msgs (into [] (map (fn [[cmd d1]] (test-msg cmd 0 d1 9)) + [[ShortMessage/NOTE_ON 1] + [ShortMessage/CONTROL_CHANGE 1] + [ShortMessage/NOTE_ON 2] + [ShortMessage/NOTE_OFF 2] + [ShortMessage/NOTE_OFF 1] + [ShortMessage/NOTE_ON 3] + [ShortMessage/NOTE_ON 4]]))] + (into [] + (transduce + sut/short-message->notes + conj + [] + (conj + msgs + (ShortMessage. ShortMessage/CONTROL_CHANGE 0 123 0)))) + := [#{1} #{1 2} #{1} #{} #{3} #{4 3} #{}])) |
