Skip to content

Commit

Permalink
Add tests for ordered weighted sampling with replacement (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tortar committed Apr 17, 2024
1 parent c41ae92 commit 81d91ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/weighted_sampling_multi_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function prob_no_replace(k)
end

@testset "Weighted sampling multi tests" begin
combs = Iterators.product([(algAExpJ, algARes, algWRSWRSKIP), (false, )]...)
combs = vec(collect(Iterators.product([(algAExpJ, algARes, algWRSWRSKIP), (false, )]...)))
push!(combs, (algWRSWRSKIP, true))
@testset "method=$method ordered=$ordered" for (method, ordered) in combs
a, b = 1, 10
# test return values of iter with known lengths are inrange
Expand Down Expand Up @@ -67,7 +68,7 @@ end
@test ordered ? issorted(s) : true

weight2(el) = el <= 5 ? 1.0 : 2.0
rng = StableRNG(43)
rng = StableRNG(41)
iters = (a:b, Iterators.filter(x -> x != b+1, a:b+1))
sizes = (1, 2)
for it in iters
Expand Down

0 comments on commit 81d91ea

Please sign in to comment.