From 15db009e6003f9c7da4672eb319fb73403bfe25e Mon Sep 17 00:00:00 2001 From: Denis Redozubov Date: Wed, 28 Jun 2023 19:12:58 +0400 Subject: [PATCH] Add more tests --- src/dsl/dsl.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/dsl/dsl.rs b/src/dsl/dsl.rs index 38243c6..65d4b69 100644 --- a/src/dsl/dsl.rs +++ b/src/dsl/dsl.rs @@ -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)] pub enum Length { 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)] pub enum Note { Hit,