Skip to content

Commit

Permalink
minor test improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarak Ben Youssef committed Jan 10, 2024
1 parent 8131b27 commit 41117f8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions runtime/stdlib/random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestRandomBasicUniformityWithModulo(t *testing.T) {
t.Skip()
}

testTypes := func(t *testing.T, testType func(*testing.T, sema.Type), allTypes bool) {
testTypes := func(t *testing.T, testType func(*testing.T, sema.Type)) {
for _, ty := range sema.AllFixedSizeUnsignedIntegerTypes {
tyCopy := ty
t.Run(ty.String(), func(t *testing.T) {
Expand All @@ -72,14 +72,14 @@ func TestRandomBasicUniformityWithModulo(t *testing.T) {
// make sure modulo fits in 8 bits
require.Less(t, modulo, 1<<8)

f := func() (uint64, error) {
moduloValue := inter.ConvertAndBox(
interpreter.EmptyLocationRange,
interpreter.NewUnmeteredUIntValueFromUint64(uint64(modulo)),
sema.UIntType,
ty,
)

moduloValue := inter.ConvertAndBox(
interpreter.EmptyLocationRange,
interpreter.NewUnmeteredUIntValueFromUint64(uint64(modulo)),
sema.UIntType,
ty,
)
f := func() (uint64, error) {

value := RevertibleRandom(
testCryptRandomGenerator{},
Expand All @@ -98,12 +98,12 @@ func TestRandomBasicUniformityWithModulo(t *testing.T) {
t.Run("power of 2 (that fits in 8 bits)", func(t *testing.T) {
t.Parallel()

testTypes(t, runStatisticsWithModulo(64), false)
testTypes(t, runStatisticsWithModulo(64))
})

t.Run("non-power of 2", func(t *testing.T) {
t.Parallel()

testTypes(t, runStatisticsWithModulo(71), false)
testTypes(t, runStatisticsWithModulo(71))
})
}

0 comments on commit 41117f8

Please sign in to comment.