Skip to content

Commit afe7676

Browse files
committed
add test checking behavior of matching on floats
1 parent 405a1c3 commit afe7676

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/ui/match/match-float.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// run-pass
2+
// Makes sure we use `==` (not bitwise) semantics for float comparison.
3+
4+
fn main() {
5+
const F1: f32 = 0.0;
6+
const F2: f32 = -0.0;
7+
assert_eq!(F1, F2);
8+
assert_ne!(F1.to_bits(), F2.to_bits());
9+
assert!(matches!(F1, F2));
10+
assert!(matches!(F2, F1));
11+
}

0 commit comments

Comments
 (0)