Fixes
This commit is contained in:
@@ -8,14 +8,14 @@ use cagire::forth::Value;
|
||||
|
||||
#[test]
|
||||
fn test_midi_channel_set() {
|
||||
let outputs = expect_outputs("60 note 100 velocity 3 chan m.", 1);
|
||||
assert!(outputs[0].starts_with("/midi/note/60/vel/100/chan/2/dur/"));
|
||||
let outputs = expect_outputs("60 note 0.8 velocity 3 chan m.", 1);
|
||||
assert!(outputs[0].starts_with("/midi/note/60/vel/101/chan/2/dur/"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_midi_note_default_channel() {
|
||||
let outputs = expect_outputs("72 note 80 velocity m.", 1);
|
||||
assert!(outputs[0].starts_with("/midi/note/72/vel/80/chan/0/dur/"));
|
||||
let outputs = expect_outputs("72 note 0.6 velocity m.", 1);
|
||||
assert!(outputs[0].starts_with("/midi/note/72/vel/76/chan/0/dur/"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -79,43 +79,43 @@ fn test_ccval_reads_from_cc_memory() {
|
||||
#[test]
|
||||
fn test_midi_channel_clamping() {
|
||||
// Channel should be clamped 1-16, then converted to 0-15 internally
|
||||
let outputs = expect_outputs("60 note 100 velocity 0 chan m.", 1);
|
||||
let outputs = expect_outputs("60 note 0.8 velocity 0 chan m.", 1);
|
||||
assert!(outputs[0].contains("/chan/0")); // 0 clamped to 1, then -1 = 0
|
||||
|
||||
let outputs = expect_outputs("60 note 100 velocity 17 chan m.", 1);
|
||||
let outputs = expect_outputs("60 note 0.8 velocity 17 chan m.", 1);
|
||||
assert!(outputs[0].contains("/chan/15")); // 17 clamped to 16, then -1 = 15
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_midi_note_clamping() {
|
||||
let outputs = expect_outputs("-1 note 100 velocity m.", 1);
|
||||
let outputs = expect_outputs("-1 note 0.8 velocity m.", 1);
|
||||
assert!(outputs[0].contains("/note/0"));
|
||||
|
||||
let outputs = expect_outputs("200 note 100 velocity m.", 1);
|
||||
let outputs = expect_outputs("200 note 0.8 velocity m.", 1);
|
||||
assert!(outputs[0].contains("/note/127"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_midi_velocity_clamping() {
|
||||
let outputs = expect_outputs("60 note -10 velocity m.", 1);
|
||||
let outputs = expect_outputs("60 note -0.1 velocity m.", 1);
|
||||
assert!(outputs[0].contains("/vel/0"));
|
||||
|
||||
let outputs = expect_outputs("60 note 200 velocity m.", 1);
|
||||
let outputs = expect_outputs("60 note 2.0 velocity m.", 1);
|
||||
assert!(outputs[0].contains("/vel/127"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_midi_defaults() {
|
||||
// With only note specified, velocity defaults to 100 and channel to 0
|
||||
// With only note specified, velocity defaults to 0.8 (101) and channel to 0
|
||||
let outputs = expect_outputs("60 note m.", 1);
|
||||
assert!(outputs[0].starts_with("/midi/note/60/vel/100/chan/0/dur/"));
|
||||
assert!(outputs[0].starts_with("/midi/note/60/vel/101/chan/0/dur/"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_midi_full_defaults() {
|
||||
// With nothing specified, defaults to note=60, velocity=100, channel=0
|
||||
// With nothing specified, defaults to note=60, velocity=0.8 (101), channel=0
|
||||
let outputs = expect_outputs("m.", 1);
|
||||
assert!(outputs[0].starts_with("/midi/note/60/vel/100/chan/0/dur/"));
|
||||
assert!(outputs[0].starts_with("/midi/note/60/vel/101/chan/0/dur/"));
|
||||
}
|
||||
|
||||
// Pitch bend tests
|
||||
@@ -344,10 +344,10 @@ fn test_midi_polyphonic_notes() {
|
||||
|
||||
#[test]
|
||||
fn test_midi_polyphonic_notes_with_velocity() {
|
||||
let outputs = expect_outputs("60 64 67 note 100 80 60 velocity m.", 3);
|
||||
assert!(outputs[0].contains("/note/60/vel/100/"));
|
||||
assert!(outputs[1].contains("/note/64/vel/80/"));
|
||||
assert!(outputs[2].contains("/note/67/vel/60/"));
|
||||
let outputs = expect_outputs("60 64 67 note 0.8 0.6 0.5 velocity m.", 3);
|
||||
assert!(outputs[0].contains("/note/60/vel/101/"));
|
||||
assert!(outputs[1].contains("/note/64/vel/76/"));
|
||||
assert!(outputs[2].contains("/note/67/vel/63/"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user