use super::*;
const TREBLE: Option<&str> = Some("treble");
const BASS: Option<&str> = Some("bass");
#[test]
fn middle_line_distances_by_clef() {
assert_eq!(middle_distance(TREBLE, 'B', 4), 0);
assert_eq!(middle_distance(TREBLE, 'G', 4), 2); assert_eq!(middle_distance(TREBLE, 'C', 5), -1); assert_eq!(middle_distance(BASS, 'D', 3), 0);
assert_eq!(middle_distance(BASS, 'F', 3), -2);
}
#[test]
fn single_note_auto_direction() {
assert!(auto_stem_up(&[2])); assert!(!auto_stem_up(&[-1])); assert!(!auto_stem_up(&[0])); }
#[test]
fn chord_uses_outermost_pair() {
assert!(!auto_stem_up(&[2, -5]));
assert!(auto_stem_up(&[2, 1]));
assert!(!auto_stem_up(&[-2, 0, 2]));
}
#[test]
fn voice_parity_overrides_in_multivoice() {
assert!(stem_up(&[-5], None, true, 0));
assert!(!stem_up(&[5], None, true, 1));
assert!(stem_up(&[], None, true, 2));
assert!(!stem_up(&[], None, true, 3));
}
#[test]
fn beam_direction_uses_whole_beam() {
assert!(stem_up(&[2], None, false, 0));
assert!(!stem_up(&[2], Some(&[2, -6]), false, 0));
}
#[test]
fn stemless_note_types() {
assert!(note_type_has_stem("quarter"));
assert!(note_type_has_stem("eighth"));
assert!(!note_type_has_stem("whole"));
assert!(!note_type_has_stem("breve"));
}
#[test]
fn multivoice_rest_offsets() {
assert_eq!(rest_display(TREBLE, 0), ('D', 5)); assert_eq!(rest_display(TREBLE, 1), ('G', 4)); assert_eq!(rest_display(BASS, 0), ('F', 3));
}
#[test]
fn slur_placement_rules() {
assert_eq!(slur_placement(Some(true), false, 0), "below"); assert_eq!(slur_placement(Some(false), false, 0), "above"); assert_eq!(slur_placement(Some(true), true, 0), "above"); assert_eq!(slur_placement(Some(true), true, 1), "below"); }
#[test]
fn tie_orientation_rules() {
assert_eq!(tie_orientation(Some(true), false), "under"); assert_eq!(tie_orientation(Some(false), false), "over");
assert_eq!(tie_orientation(Some(true), true), "over"); assert_eq!(tie_orientation(Some(false), true), "under");
}