diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-02-18 09:31:12 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-02-19 21:48:20 +0100 |
| commit | dd768bf1c623521b27d1b16ab50a7b80cbcf8b37 (patch) | |
| tree | b6f686e750447c27343bfd06e3bd7eb6172468a6 /prog/mutation_test.go | |
| parent | 833f78c7b023badf3ac188005adaf5fb1a20f56e (diff) | |
prog: reorder Minimize arguments
Make the predicate the last argument.
It's more common and convenient (arguments are not separated by multiple lines).
Diffstat (limited to 'prog/mutation_test.go')
| -rw-r--r-- | prog/mutation_test.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/prog/mutation_test.go b/prog/mutation_test.go index 72f0e3cac..6452eddfa 100644 --- a/prog/mutation_test.go +++ b/prog/mutation_test.go @@ -301,7 +301,7 @@ func TestMinimize(t *testing.T) { if err != nil { t.Fatalf("failed to deserialize original program #%v: %v", ti, err) } - p1, ci := Minimize(p, test.callIndex, test.pred, false) + p1, ci := Minimize(p, test.callIndex, false, test.pred) res := p1.Serialize() if string(res) != test.result { t.Fatalf("minimization produced wrong result #%v\norig:\n%v\nexpect:\n%v\ngot:\n%v\n", @@ -319,21 +319,21 @@ func TestMinimizeRandom(t *testing.T) { iters /= 10 // Long test. for i := 0; i < iters; i++ { p := target.Generate(rs, 5, nil) - Minimize(p, len(p.Calls)-1, func(p1 *Prog, callIndex int) bool { + Minimize(p, len(p.Calls)-1, true, func(p1 *Prog, callIndex int) bool { return false - }, true) - Minimize(p, len(p.Calls)-1, func(p1 *Prog, callIndex int) bool { + }) + Minimize(p, len(p.Calls)-1, true, func(p1 *Prog, callIndex int) bool { return true - }, true) + }) } for i := 0; i < iters; i++ { p := target.Generate(rs, 5, nil) - Minimize(p, len(p.Calls)-1, func(p1 *Prog, callIndex int) bool { + Minimize(p, len(p.Calls)-1, false, func(p1 *Prog, callIndex int) bool { return false - }, false) - Minimize(p, len(p.Calls)-1, func(p1 *Prog, callIndex int) bool { + }) + Minimize(p, len(p.Calls)-1, false, func(p1 *Prog, callIndex int) bool { return true - }, false) + }) } } @@ -343,9 +343,9 @@ func TestMinimizeCallIndex(t *testing.T) { for i := 0; i < iters; i++ { p := target.Generate(rs, 5, nil) ci := r.Intn(len(p.Calls)) - p1, ci1 := Minimize(p, ci, func(p1 *Prog, callIndex int) bool { + p1, ci1 := Minimize(p, ci, r.Intn(2) == 0, func(p1 *Prog, callIndex int) bool { return r.Intn(2) == 0 - }, r.Intn(2) == 0) + }) if ci1 < 0 || ci1 >= len(p1.Calls) || p.Calls[ci].Meta.Name != p1.Calls[ci1].Meta.Name { t.Fatalf("bad call index after minimization") } |
