aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-17 11:18:15 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-18 11:34:42 +0200
commitba2826f39e64847f3250cf134b7a51b942eb3673 (patch)
tree7990192f05f381ce44ef7b4bdf083d665138b714 /prog/mutation_test.go
parent17b3eb97de1822644d1611efbfc9c7cd2dd7722c (diff)
prog: reduce number of allocations in Mutate
Don't allocate 3 parallel slices.
Diffstat (limited to 'prog/mutation_test.go')
-rw-r--r--prog/mutation_test.go33
1 files changed, 0 insertions, 33 deletions
diff --git a/prog/mutation_test.go b/prog/mutation_test.go
index 77c049a37..66443ad34 100644
--- a/prog/mutation_test.go
+++ b/prog/mutation_test.go
@@ -6,7 +6,6 @@ package prog
import (
"bytes"
"fmt"
- "math"
"math/rand"
"testing"
)
@@ -182,38 +181,6 @@ func TestSizeMutateArg(t *testing.T) {
}
}
-func TestRandomChoice(t *testing.T) {
- t.Parallel()
- target, err := GetTarget("test", "64")
- if err != nil {
- t.Fatal(err)
- }
-
- r := newRand(target, randSource(t))
- priorities := []float64{1, 1, 1, 1, 1, 1, 1, 1, 2}
-
- const (
- maxIters = 100000
- searchedIdx = 8
- prob = 0.2
- eps = 0.01
- )
-
- var index, count int
- for i := 0; i < maxIters; i++ {
- index = randomChoice(priorities, r)
-
- if index == searchedIdx {
- count++
- }
- }
-
- diff := math.Abs(prob*maxIters - float64(count))
- if diff > eps*maxIters {
- t.Fatalf("The difference (%f) is higher than %f%%", diff, eps*100)
- }
-}
-
func TestClone(t *testing.T) {
target, rs, iters := initTest(t)
ct := target.DefaultChoiceTable()