From ba2826f39e64847f3250cf134b7a51b942eb3673 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 17 May 2020 11:18:15 +0200 Subject: prog: reduce number of allocations in Mutate Don't allocate 3 parallel slices. --- prog/mutation_test.go | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'prog/mutation_test.go') 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() -- cgit mrf-deployment