Skip to content

Commit

Permalink
Better test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram Van de Walle committed Aug 16, 2024
1 parent 46a67c7 commit 9be284c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions find_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,9 @@ func TestSampleBy(t *testing.T) {
t.Parallel()
is := assert.New(t)

result1 := SampleBy([]string{"a", "b", "c"}, rand.Intn)
r := rand.New(rand.NewSource(42))

result1 := SampleBy([]string{"a", "b", "c"}, r.Intn)
result2 := SampleBy([]string{}, rand.Intn)

is.True(Contains([]string{"a", "b", "c"}, result1))
Expand Down Expand Up @@ -586,8 +588,10 @@ func TestSamplesBy(t *testing.T) {
t.Parallel()
is := assert.New(t)

result1 := SamplesBy([]string{"a", "b", "c"}, 3, rand.Intn)
result2 := SamplesBy([]string{}, 3, rand.Intn)
r := rand.New(rand.NewSource(42))

result1 := SamplesBy([]string{"a", "b", "c"}, 3, r.Intn)
result2 := SamplesBy([]string{}, 3, r.Intn)

sort.Strings(result1)

Expand Down

0 comments on commit 9be284c

Please sign in to comment.