Add unit tests for max

This commit is contained in:
sharkdp committed 2018-01-18 18:58:51 +01:00
1 parent bd5d5fd4fa
commit 93386dc808
1 file changed
+9
+9
View File
@@ -96,3 +96,12 @@ pub fn min(vals: &[f64]) -> f64 {
.unwrap()
.clone()
}
#[test]
fn test_max() {
assert_eq!(1.0, max(&[1.0]));
assert_eq!(-1.0, max(&[-1.0]));
assert_eq!(-1.0, max(&[-2.0, -1.0]));
assert_eq!(1.0, max(&[-1.0, 1.0]));
assert_eq!(1.0, max(&[-1.0, 1.0, 0.0]));
}