Add test for different NaNs

This commit is contained in:
Taylor Cramer 2016-07-13 09:35:31 -07:00
parent 0dd13b0db2
commit 0c21a6b0c4
1 changed files with 15 additions and 0 deletions

View File

@ -249,6 +249,21 @@ fn if_same_then_else() -> Result<&'static str, ()> {
-0.0
};
// Different NaNs
let _ = if true {
1.0 / 0.0
} else {
(-5f32).sqrt()
};
// Same NaNs
let _ = if true {
//~^NOTE same as this
std::f32::NAN
} else { //~ERROR this `if` has identical blocks
std::f32::NAN
};
let _ = match Some(()) {
Some(()) => 0.0,
None => -0.0