From 2943a2514bdac9fd27502079a18eaf5a173cf3a9 Mon Sep 17 00:00:00 2001 From: Rico Riedel Date: Mon, 1 Aug 2022 15:33:57 +0200 Subject: [PATCH] Fix char converter --- src/convert/char.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/convert/char.rs b/src/convert/char.rs index 1825df6..004072d 100644 --- a/src/convert/char.rs +++ b/src/convert/char.rs @@ -26,14 +26,14 @@ impl CharConverterImpl { impl CharConverter for CharConverterImpl { fn convert(&self, level: f32) -> CharSample { if level < 0.0 { - CharSample::Keep + CharSample::Clear } else if level < 1.0 { let index = (level * self.count) as usize; let char = self.chars.chars().nth(index).unwrap(); CharSample::Draw(char) } else { - CharSample::Clear + CharSample::Keep } } } @@ -43,10 +43,10 @@ mod test { use super::*; #[test] - fn convert_keep() { + fn convert_clear() { let converter = CharConverterImpl::new("abc".to_string()); - assert_eq!(CharSample::Keep, converter.convert(-0.1)); + assert_eq!(CharSample::Clear, converter.convert(-0.1)); } #[test] @@ -59,10 +59,10 @@ mod test { } #[test] - fn convert_clear() { + fn convert_keep() { let converter = CharConverterImpl::new("123".to_string()); - assert_eq!(CharSample::Clear, converter.convert(1.0)); - assert_eq!(CharSample::Clear, converter.convert(1.5)); + assert_eq!(CharSample::Keep, converter.convert(1.0)); + assert_eq!(CharSample::Keep, converter.convert(1.5)); } }