Skip to content

Commit

Permalink
Test all methods of weighted sampling single (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tortar committed Apr 20, 2024
1 parent 2abf497 commit 5539bed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/weighted_sampling_single_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
@testset "method=$method" for method in (algARes, algAExpJ)
wv(el) = 1.0
a, b = 1, 100
z = itsample(a:b, wv)
z = itsample(a:b, wv, method)
@test a <= z <= b
z = itsample(Iterators.filter(x -> x != b+1, a:b+1), wv)
z = itsample(Iterators.filter(x -> x != b+1, a:b+1), wv, method)
@test a <= z <= b
rng = StableRNG(43)
wv2(el) = el <= 50 ? 1.0 : 2.0
Expand All @@ -14,7 +14,7 @@
reps = 10000
dict_res = Dict{Int, Int}()
for _ in 1:reps
s = itsample(rng, it, wv2)
s = itsample(rng, it, wv2, method)
if s in keys(dict_res)
dict_res[s] += 1
else
Expand Down

0 comments on commit 5539bed

Please sign in to comment.