diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2024-08-26 04:23:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-25 22:23:30 +0200 |
commit | 0d53b6e027a66bc60ca853d57c019338bb73ba0b (patch) | |
tree | eb96d2d278b118593e6c1aaa7b595f1ff4dfc046 /tests/stdlib | |
parent | 4ef06a5cc56f6ef32b8ac1e7c11592597406486a (diff) | |
download | Nim-0d53b6e027a66bc60ca853d57c019338bb73ba0b.tar.gz |
fixes #23915; std/random produces different results on c/js (#24003)
fixes #23915
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/trandom.nim | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/stdlib/trandom.nim b/tests/stdlib/trandom.nim index bec75c1eb..eb32f7757 100644 --- a/tests/stdlib/trandom.nim +++ b/tests/stdlib/trandom.nim @@ -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,10 +298,13 @@ block: # bug #22360 else: inc fc - when defined(js): - when compileOption("jsbigint64"): - doAssert (tc, fc) == (517, 483), $(tc, fc) - else: - doAssert (tc, fc) == (515, 485), $(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 |