diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2017-08-01 15:28:12 +0200 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@google.com> | 2017-08-01 15:57:03 +0200 |
| commit | 493773c70dcb7c21f94b2325e0970c606eb50f34 (patch) | |
| tree | cbba57b7fb38eb6983da9d9c5a00993b54ce0ba8 /prog/mutation_test.go | |
| parent | 032fb6f70ae1f26d2febedb6c566e341aaa5e039 (diff) | |
prog: properly remove calls when splicing progs
Use removeCall() to update use references.
Also add a test and speed up other ones.
Diffstat (limited to 'prog/mutation_test.go')
| -rw-r--r-- | prog/mutation_test.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/prog/mutation_test.go b/prog/mutation_test.go index 57b049376..44a6eabc3 100644 --- a/prog/mutation_test.go +++ b/prog/mutation_test.go @@ -46,6 +46,19 @@ next: } } +func TestMutateCorpus(t *testing.T) { + rs, iters := initTest(t) + var corpus []*Prog + for i := 0; i < 100; i++ { + p := Generate(rs, 10, nil) + corpus = append(corpus, p) + } + for i := 0; i < iters; i++ { + p1 := Generate(rs, 10, nil) + p1.Mutate(rs, 10, nil, corpus) + } +} + func TestMutateTable(t *testing.T) { tests := [][2]string{ // Insert calls. @@ -276,8 +289,9 @@ func TestMinimize(t *testing.T) { func TestMinimizeRandom(t *testing.T) { rs, iters := initTest(t) + iters /= 10 // Long test. for i := 0; i < iters; i++ { - p := Generate(rs, 10, nil) + p := Generate(rs, 5, nil) Minimize(p, len(p.Calls)-1, func(p1 *Prog, callIndex int) bool { if err := p1.validate(); err != nil { t.Fatalf("invalid program: %v", err) @@ -292,7 +306,7 @@ func TestMinimizeRandom(t *testing.T) { }, true) } for i := 0; i < iters; i++ { - p := Generate(rs, 10, nil) + p := Generate(rs, 5, nil) Minimize(p, len(p.Calls)-1, func(p1 *Prog, callIndex int) bool { if err := p1.validate(); err != nil { t.Fatalf("invalid program: %v", err) |
