summary refs log tree commit diff stats
path: root/tests/stdlib/trandom.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/trandom.nim')
-rw-r--r--tests/stdlib/trandom.nim14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/stdlib/trandom.nim b/tests/stdlib/trandom.nim
index 920d429d4..eb32f7757 100644
--- a/tests/stdlib/trandom.nim
+++ b/tests/stdlib/trandom.nim
@@ -1,6 +1,6 @@
 discard """
   joinable: false # to avoid messing with global rand state
-  matrix: "--mm:refc; --mm:orc; --backend:js --jsbigint64:off; --backend:js --jsbigint64:on"
+  matrix: "--mm:refc; --mm:orc; --backend:js --jsbigint64:off -d:nimStringHash2; --backend:js --jsbigint64:on"
 """
 import std/[assertions, formatfloat]
 import std/[random, math, stats, sets, tables]
@@ -47,6 +47,8 @@ block:
   type DiceRoll = range[0..6]
   when not defined(js):
     doAssert rand(DiceRoll).int == 3
+  elif compileOption("jsbigint64"):
+    doAssert rand(DiceRoll).int == 1
   else:
     doAssert rand(DiceRoll).int == 6
 
@@ -296,7 +298,13 @@ block: # bug #22360
     else:
       inc fc
 
-  when defined(js):
-    doAssert (tc, fc) == (483, 517), $(tc, fc)
+  when defined(js) and not compileOption("jsbigint64"):
+    doAssert (tc, fc) == (515, 485), $(tc, fc)
   else:
     doAssert (tc, fc) == (510, 490), $(tc, fc)
+
+block:
+  when defined(js) and not compileOption("jsbigint64"):
+    doAssert rand(int32.high) == 335507522
+  else:
+    doAssert rand(int32.high) == 607539621