mirror of
https://github.com/ricoriedel/wipe.git
synced 2024-11-04 23:26:41 +00:00
Simplify tests
This commit is contained in:
parent
1f03a8fd13
commit
56e630204a
@ -33,34 +33,34 @@ mod test {
|
||||
fn convert_negative_index() {
|
||||
let converter = ColorConverterImpl::new(vec![Red, Green, Blue]);
|
||||
|
||||
assert!(matches!(converter.convert(-0.2), Blue));
|
||||
assert_eq!(Blue, converter.convert(-0.2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convert_index_zero() {
|
||||
let converter = ColorConverterImpl::new(vec![Red, Green, Blue]);
|
||||
|
||||
assert!(matches!(converter.convert(0.0), Red));
|
||||
assert_eq!(Red, converter.convert(0.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convert() {
|
||||
let converter = ColorConverterImpl::new(vec![Red, Green, Blue]);
|
||||
|
||||
assert!(matches!(converter.convert(0.5), Green));
|
||||
assert_eq!(Green, converter.convert(0.5));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convert_index_one() {
|
||||
let converter = ColorConverterImpl::new(vec![Red, Green, Blue]);
|
||||
|
||||
assert!(matches!(converter.convert(1.0), Red));
|
||||
assert_eq!(Red, converter.convert(1.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convert_index_above_one() {
|
||||
let converter = ColorConverterImpl::new(vec![Red, Green, Blue]);
|
||||
|
||||
assert!(matches!(converter.convert(1.5), Green));
|
||||
assert_eq!(Green, converter.convert(1.5));
|
||||
}
|
||||
}
|
||||
|
@ -33,35 +33,23 @@ mod test {
|
||||
fn convert_keep() {
|
||||
let converter = LevelConverterImpl::default();
|
||||
|
||||
assert!(matches!(converter.convert(-0.1), Level::Keep));
|
||||
assert_eq!(Level::Keep, converter.convert(-0.1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convert_draw() {
|
||||
let converter = LevelConverterImpl::default();
|
||||
|
||||
if let Level::Draw(level) = converter.convert(0.0) {
|
||||
assert_eq!(0.0, level);
|
||||
} else {
|
||||
panic!();
|
||||
}
|
||||
if let Level::Draw(level) = converter.convert(0.5) {
|
||||
assert_eq!(0.5, level);
|
||||
} else {
|
||||
panic!();
|
||||
}
|
||||
if let Level::Draw(level) = converter.convert(0.9) {
|
||||
assert_eq!(0.9, level);
|
||||
} else {
|
||||
panic!();
|
||||
}
|
||||
assert_eq!(Level::Draw(0.0), converter.convert(0.0));
|
||||
assert_eq!(Level::Draw(0.5), converter.convert(0.5));
|
||||
assert_eq!(Level::Draw(0.9), converter.convert(0.9));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn convert_clear() {
|
||||
let converter = LevelConverterImpl::default();
|
||||
|
||||
assert!(matches!(converter.convert(1.0), Level::Clear));
|
||||
assert!(matches!(converter.convert(1.5), Level::Clear));
|
||||
assert_eq!(Level::Clear, converter.convert(1.0));
|
||||
assert_eq!(Level::Clear, converter.convert(1.5));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user