Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed Mar 25, 2023
1 parent ea965a1 commit 0b075f8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/threads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,25 @@ end
@test_throws ArgumentError @macroexpand(@threads 1) # arg isn't an Expr
@test_throws ArgumentError @macroexpand(@threads if true 1 end) # arg doesn't start with for
end

using Random

@testset "RNG: child doesn't affect parent" begin
seeds = rand(UInt64, 5)
for seed in seeds
Random.seed!(seed)
x = rand(UInt64)
y = rand(UInt64)
for n = 1:5
Random.seed!(seed)
@sync for i = 1:n
@async rand(UInt64)
end
@test x == rand(UInt64)
@sync for i = 1:n
@async rand(UInt64)
end
@test y == rand(UInt64)
end
end
end

0 comments on commit 0b075f8

Please sign in to comment.