summary refs log tree commit diff stats
path: root/tests/run
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-09-08 14:11:00 -0700
committerAraq <rumpf_a@web.de>2012-09-08 14:11:00 -0700
commit4cd795b3eefce8fad3a933848455e677b2e2c67b (patch)
treef1f552956563d3c43a5259d0ebc14a9e3995dad9 /tests/run
parent46f652b93eec44f25de25df9e9362448d857bfbe (diff)
parent664bd55e852f237dec03913accedcc5291863048 (diff)
downloadNim-4cd795b3eefce8fad3a933848455e677b2e2c67b.tar.gz
Merge pull request #198 from Tass/master
Implements hash(float)
Diffstat (limited to 'tests/run')
-rw-r--r--tests/run/thashes.nim8
-rw-r--r--tests/run/tmath.nim14
2 files changed, 14 insertions, 8 deletions
diff --git a/tests/run/thashes.nim b/tests/run/thashes.nim
new file mode 100644
index 000000000..c442b43fb
--- /dev/null
+++ b/tests/run/thashes.nim
@@ -0,0 +1,8 @@
+import unittest
+import hashes
+
+suite "hashes":
+  suite "hashing":
+    test "0.0 and -0.0 should have the same hash value":
+      var dummy = 0.0
+      check hash(dummy) == hash(-dummy)
diff --git a/tests/run/tmath.nim b/tests/run/tmath.nim
index 65124306e..a86a3b84c 100644
--- a/tests/run/tmath.nim
+++ b/tests/run/tmath.nim
@@ -25,14 +25,12 @@ suite "random int":
       check rand >= 100
 
 suite "random float":
-  # Enable this once #197 has been resolved
-  # test "there might be some randomness":
-  #   var set = initSet[float](128)
-  #   for i in 1..10:
-  #     for j in 1..10:
-  #       randomize()
-  #       incl(set, random(1.0))
-  #   check len(set) == 100
+  test "there might be some randomness":
+    var set = initSet[float](128)
+    randomize()
+    for i in 1..100:
+      incl(set, random(1.0))
+    check len(set) == 100
   test "single number bounds work":
     randomize()
     var rand: float