about summary refs log tree commit diff
path: root/src/test/stdtest/float.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/stdtest/float.rs')
-rw-r--r--src/test/stdtest/float.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/stdtest/float.rs b/src/test/stdtest/float.rs
index b77d83eb757..086942fb8c1 100644
--- a/src/test/stdtest/float.rs
+++ b/src/test/stdtest/float.rs
@@ -15,5 +15,24 @@ fn test_from_str() {
    assert ( float::from_str("5.") == 5. );
    assert ( float::from_str(".5") == 0.5 );
    assert ( float::from_str("0.5") == 0.5 );
+}
 
+#[test]
+fn test_positive() {
+  assert(float::positive(float::infinity()));
+  assert(float::positive(1.));
+  assert(float::positive(0.));
+  assert(!float::positive(-1.));
+  assert(!float::positive(float::neg_infinity()));
+  assert(!float::positive(1./float::neg_infinity()));
+}
+
+#[test]
+fn test_negative() {
+  assert(!float::negative(float::infinity()));
+  assert(!float::negative(1.));
+  assert(!float::negative(0.));
+  assert(float::negative(-1.));
+  assert(float::negative(float::neg_infinity()));
+  assert(float::negative(1./float::neg_infinity()));
 }