about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/failing-ui-tests.txt1
-rw-r--r--tests/run/float.rs32
2 files changed, 32 insertions, 1 deletions
diff --git a/tests/failing-ui-tests.txt b/tests/failing-ui-tests.txt
index 082958bfe1f..579ac3749e9 100644
--- a/tests/failing-ui-tests.txt
+++ b/tests/failing-ui-tests.txt
@@ -5,7 +5,6 @@ tests/ui/asm/x86_64/multiple-clobber-abi.rs
 tests/ui/functions-closures/parallel-codegen-closures.rs
 tests/ui/linkage-attr/linkage1.rs
 tests/ui/lto/dylib-works.rs
-tests/ui/numbers-arithmetic/saturating-float-casts.rs
 tests/ui/sepcomp/sepcomp-cci.rs
 tests/ui/sepcomp/sepcomp-extern.rs
 tests/ui/sepcomp/sepcomp-fns-backwards.rs
diff --git a/tests/run/float.rs b/tests/run/float.rs
new file mode 100644
index 00000000000..e0a57e6fed1
--- /dev/null
+++ b/tests/run/float.rs
@@ -0,0 +1,32 @@
+// Compiler:
+//
+// Run-time:
+//   status: 0
+
+#![feature(const_black_box)]
+
+/*
+ * Code
+ */
+
+fn main() {
+    use std::hint::black_box;
+
+    macro_rules! check {
+        ($ty:ty, $expr:expr) => {{
+            const EXPECTED: $ty = $expr;
+            assert_eq!($expr, EXPECTED);
+        }};
+    }
+
+    check!(i32, (black_box(0.0f32) as i32));
+
+    check!(u64, (black_box(f32::NAN) as u64));
+    check!(u128, (black_box(f32::NAN) as u128));
+
+    check!(i64, (black_box(f64::NAN) as i64));
+    check!(u64, (black_box(f64::NAN) as u64));
+
+    check!(i16, (black_box(f32::MIN) as i16));
+    check!(i16, (black_box(f32::MAX) as i16));
+}