aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-11-29 09:47:55 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-11-29 11:12:47 +0100
commit3a80fe350da4f5fc054c06fe279cc7ea734eb28b (patch)
tree4022743a66524b3534fc30eb7ef73e2af36761e5 /prog/mutation_test.go
parent1a6a7478c298a362d63a2f412155c70b7f97671d (diff)
prog: support bytesizeN for vma
I guess this is currently unused, but ignoring bytesizeN for vma looks wrong. If user asks for bytesizeN for vma, divide vma size by N.
Diffstat (limited to 'prog/mutation_test.go')
-rw-r--r--prog/mutation_test.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/prog/mutation_test.go b/prog/mutation_test.go
index 1fe2da9eb..418ca3659 100644
--- a/prog/mutation_test.go
+++ b/prog/mutation_test.go
@@ -23,7 +23,7 @@ func TestClone(t *testing.T) {
}
}
-func TestMutate(t *testing.T) {
+func TestMutateRandom(t *testing.T) {
target, rs, iters := initTest(t)
next:
for i := 0; i < iters; i++ {
@@ -36,12 +36,17 @@ next:
p1.Mutate(rs, 10, nil, nil)
data := p.Serialize()
if !bytes.Equal(data0, data) {
- t.Fatalf("program changed after clone/mutate\noriginal:\n%s\n\nnew:\n%s\n", data0, data)
+ t.Fatalf("program changed after clone/mutate\noriginal:\n%s\n\nnew:\n%s\n",
+ data0, data)
}
data1 := p1.Serialize()
- if !bytes.Equal(data, data1) {
- continue next
+ if bytes.Equal(data, data1) {
+ continue
}
+ if _, err := target.Deserialize(data1); err != nil {
+ t.Fatalf("Deserialize failed after Mutate: %v\n%s", err, data1)
+ }
+ continue next
}
t.Fatalf("mutation does not change program:\n%s", data0)
}