Add more tests

This commit is contained in:
Denis Redozubov 2023-06-28 19:12:58 +04:00
parent 352f79a03f
commit 15db009e60

View file

@ -186,6 +186,11 @@ impl KnownLength for ModdedLength {
} }
} }
#[test]
fn test_known_length_modded_length() {
assert_eq!(ModdedLength::Dotted(BasicLength::Eighth).to_128th(), 24);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Length { pub enum Length {
Simple(ModdedLength), Simple(ModdedLength),
@ -203,6 +208,14 @@ impl KnownLength for Length {
} }
} }
#[test]
fn test_known_length_of_length() {
let dotted_eighth = ModdedLength::Dotted(BasicLength::Eighth);
let triplet_dotted_eighth = Length::Triplet(dotted_eighth);
assert_eq!(Length::Tied(dotted_eighth, dotted_eighth).to_128th(), 48);
assert_eq!(triplet_dotted_eighth.to_128th(), 16);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Note { pub enum Note {
Hit, Hit,