Skip to content

Commit 6026d3b

Browse files
committed
Use StableRNG in tests
1 parent 8b9119c commit 6026d3b

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
@@ -9,11 +9,13 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
99

1010
[compat]
1111
Requires = "1"
12+
StableRNGs = "1"
1213
julia = "1"
1314

1415
[extras]
1516
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
17+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
1618
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1719

1820
[targets]
19-
test = ["Documenter", "Test"]
21+
test = ["Documenter", "StableRNGs", "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
using Base.Checked
44

test/fixed.jl

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

678678
@testset "rand" begin
679679
test_rand(Fixed)
680-
@test rand(MersenneTwister(1234), Q0f7) === -0.156Q0f7
680+
@test !(rand(Q0f15) == rand(Q0f15) == rand(Q0f15)) # If this fails, we should suspect a bug.
681+
@test rand(StableRNG(1234), Q0f7) === 0.531Q0f7
681682
end
682683

683684
@testset "Promotion within Fixed" begin

test/normed.jl

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

651651
@testset "rand" begin
652652
test_rand(Normed)
653-
@test rand(MersenneTwister(1234), N0f8) === 0.925N0f8
653+
@test !(rand(N0f16) == rand(N0f16) == rand(N0f16)) # If this fails, we should suspect a bug.
654+
@test rand(StableRNG(1234), N0f8) === 0.267N0f8
654655
end
655656

656657
@testset "Promotion within Normed" begin

0 commit comments

Comments
 (0)