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