diff --git a/test/ConcurrentCollectionsTests/src/test_msqueue.jl b/test/ConcurrentCollectionsTests/src/test_msqueue.jl index 5b8d683..53b07ce 100644 --- a/test/ConcurrentCollectionsTests/src/test_msqueue.jl +++ b/test/ConcurrentCollectionsTests/src/test_msqueue.jl @@ -44,17 +44,20 @@ end function test_push_pop() @testset for T in [Int, Any, Int, Any] - xs = 1:2^10 - if T !== eltype(xs) - xs = collect(T, xs) - end - yss, _ = pushpop(xs) - @test all(allunique, yss) - @debug "pushpop(xs)" length.(yss) - ys = sort!(foldl(append!, yss; init = T[])) - @debug "pushpop(xs)" setdiff(ys, xs) setdiff(xs, ys) length(xs) length(ys) - @test ys == xs + test_random_push_pop(T) + end +end + +function test_random_push_pop(T::Type, xs = 1:2^10) + if T !== eltype(xs) + xs = collect(T, xs) end + yss, _ = pushpop(xs) + @test all(allunique, yss) + @debug "pushpop(xs)" length.(yss) + ys = sort!(foldl(append!, yss; init = T[])) + @debug "pushpop(xs)" setdiff(ys, xs) setdiff(xs, ys) length(xs) length(ys) + @test ys == xs end end # module diff --git a/test/ConcurrentCollectionsTests/src/test_tsstack.jl b/test/ConcurrentCollectionsTests/src/test_tsstack.jl index 14574a7..b8d6bf6 100644 --- a/test/ConcurrentCollectionsTests/src/test_tsstack.jl +++ b/test/ConcurrentCollectionsTests/src/test_tsstack.jl @@ -44,17 +44,20 @@ end function test_push_pop() @testset for T in [Int, Any, Int, Any] - xs = 1:2^10 - if T !== eltype(xs) - xs = collect(T, xs) - end - yss, _ = pushpop(xs) - @test all(allunique, yss) - @debug "pushpop(xs)" length.(yss) - ys = sort!(foldl(append!, yss; init = T[])) - @debug "pushpop(xs)" setdiff(ys, xs) setdiff(xs, ys) length(xs) length(ys) - @test ys == xs + test_random_push_pop(T) + end +end + +function test_random_push_pop(T::Type, xs = 1:2^10) + if T !== eltype(xs) + xs = collect(T, xs) end + yss, _ = pushpop(xs) + @test all(allunique, yss) + @debug "pushpop(xs)" length.(yss) + ys = sort!(foldl(append!, yss; init = T[])) + @debug "pushpop(xs)" setdiff(ys, xs) setdiff(xs, ys) length(xs) length(ys) + @test ys == xs end end # module diff --git a/test/ConcurrentCollectionsTests/src/test_work_stealing_deque.jl b/test/ConcurrentCollectionsTests/src/test_work_stealing_deque.jl index 280dd17..c737c90 100644 --- a/test/ConcurrentCollectionsTests/src/test_work_stealing_deque.jl +++ b/test/ConcurrentCollectionsTests/src/test_work_stealing_deque.jl @@ -64,19 +64,21 @@ end function test_random_push_pop() @testset for T in [Int, Any, Int, Any] - # xs = 1:2^20 - xs = 1:2^10 - if T !== eltype(xs) - xs = collect(T, xs) - end - zs, yss = random_pushpop(xs) - @test allunique(zs) - @test all(allunique, yss) - @debug "random_pushpop(xs)" length(zs) length.(yss) - ys = sort!(foldl(append!, yss; init = copy(zs))) - @debug "random_pushpop(xs)" setdiff(ys, xs) setdiff(xs, ys) length(xs) length(ys) - @test ys == xs + test_random_push_pop(T) + end +end + +function test_random_push_pop(T::Type, xs = 1:2^10) + if T !== eltype(xs) + xs = collect(T, xs) end + zs, yss = random_pushpop(xs) + @test allunique(zs) + @test all(allunique, yss) + @debug "random_pushpop(xs)" length(zs) length.(yss) + ys = sort!(foldl(append!, yss; init = copy(zs))) + @debug "random_pushpop(xs)" setdiff(ys, xs) setdiff(xs, ys) length(xs) length(ys) + @test ys == xs end end # module