Skip to content

Commit 954bbd8

Browse files
committed
Use StableRNG in tests (#278)
1 parent 632710b commit 954bbd8

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1313
FixedPointNumbersStatisticsExt = "Statistics"
1414

1515
[compat]
16+
StableRNGs = "1"
1617
# Update this version specifier when Statistics.jl v1.11.2 is released.
1718
# https://github.com/JuliaStats/Statistics.jl/issues/165
1819
Statistics = "< 1.11.2"
1920
julia = "1"
2021

2122
[extras]
2223
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
24+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
2325
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2426
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2527

2628
[targets]
27-
test = ["Documenter", "Statistics", "Test"]
29+
test = ["Documenter", "StableRNGs", "Statistics", "Test"]

test/common.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using FixedPointNumbers, Statistics, Random, Test
1+
using FixedPointNumbers, Statistics, Random, StableRNGs, Test
22
using FixedPointNumbers: bitwidth, rawtype, nbitsfrac
33

44
SP = VERSION >= v"1.6.0-DEV.771" ? " " : "" # JuliaLang/julia #37085

test/fixed.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ end
504504

505505
@testset "rand" begin
506506
test_rand(Fixed)
507-
@test rand(MersenneTwister(1234), Q0f7) === -0.156Q0f7
507+
@test !(rand(Q0f15) == rand(Q0f15) == rand(Q0f15)) # If this fails, we should suspect a bug.
508+
@test rand(StableRNG(1234), Q0f7) === 0.531Q0f7
508509
end
509510

510511
@testset "Promotion within Fixed" begin

test/normed.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ end
520520

521521
@testset "rand" begin
522522
test_rand(Normed)
523-
@test rand(MersenneTwister(1234), N0f8) === 0.925N0f8
523+
@test !(rand(N0f16) == rand(N0f16) == rand(N0f16)) # If this fails, we should suspect a bug.
524+
@test rand(StableRNG(1234), N0f8) === 0.267N0f8
524525
end
525526

526527
@testset "Promotion within Normed" begin

0 commit comments

Comments
 (0)