Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions test/ConcurrentCollectionsTests/src/test_msqueue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 13 additions & 10 deletions test/ConcurrentCollectionsTests/src/test_tsstack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 14 additions & 12 deletions test/ConcurrentCollectionsTests/src/test_work_stealing_deque.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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