prog: deduplicate minimization test

Update 
This commit is contained in:
Dmitry Vyukov 2018-05-07 14:53:35 +02:00
parent 8041642739
commit df6e2fb6df
2 changed files with 10 additions and 17 deletions

@ -6,7 +6,7 @@
"minconstlength": 7,
"linelength": 120,
"cyclo": 50,
"duplthreshold": 80,
"duplthreshold": 63,
"skip": [
"pkg/kd",
"sys/akaros/gen",

@ -123,22 +123,15 @@ func TestMinimizeRandom(t *testing.T) {
target, rs, iters := initTest(t)
iters /= 10 // Long test.
for i := 0; i < iters; i++ {
p := target.Generate(rs, 5, nil)
Minimize(p, len(p.Calls)-1, true, func(p1 *Prog, callIndex int) bool {
return false
})
Minimize(p, len(p.Calls)-1, true, func(p1 *Prog, callIndex int) bool {
return true
})
}
for i := 0; i < iters; i++ {
p := target.Generate(rs, 5, nil)
Minimize(p, len(p.Calls)-1, false, func(p1 *Prog, callIndex int) bool {
return false
})
Minimize(p, len(p.Calls)-1, false, func(p1 *Prog, callIndex int) bool {
return true
})
for _, crash := range []bool{false, true} {
p := target.Generate(rs, 5, nil)
Minimize(p, len(p.Calls)-1, crash, func(p1 *Prog, callIndex int) bool {
return false
})
Minimize(p, len(p.Calls)-1, crash, func(p1 *Prog, callIndex int) bool {
return true
})
}
}
}