Add panic unit tests
This commit is contained in:
parent
2e34ff7671
commit
b762283e57
|
@ -1777,4 +1777,22 @@ mod tests {
|
|||
assert_ne!(nan_masked & QNAN_MASK, 0);
|
||||
assert!(nan_masked_fl.is_nan());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_clamp_min_greater_than_max() {
|
||||
1.0f32.clamp(3.0, 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_clamp_min_is_nan() {
|
||||
1.0f32.clamp(NAN, 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_clamp_max_is_nan() {
|
||||
1.0f32.clamp(3.0, NAN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1668,4 +1668,22 @@ mod tests {
|
|||
assert_approx_eq!(f64::from_bits(0x4094e40000000000), 1337.0);
|
||||
assert_approx_eq!(f64::from_bits(0xc02c800000000000), -14.25);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_clamp_min_greater_than_max() {
|
||||
1.0f64.clamp(3.0, 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_clamp_min_is_nan() {
|
||||
1.0f64.clamp(NAN, 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_clamp_max_is_nan() {
|
||||
1.0f64.clamp(3.0, NAN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,6 +249,7 @@
|
|||
#![feature(cfg_target_vendor)]
|
||||
#![feature(char_error_internals)]
|
||||
#![feature(char_internals)]
|
||||
#![feature(clamp)]
|
||||
#![feature(collections_range)]
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(const_fn)]
|
||||
|
|
Loading…
Reference in New Issue