Skip to content

Commit 42327e9

Browse files
committed
fix: avoid reducing the last op in reduction process
1 parent 33e6fed commit 42327e9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/metamorphic/reduce_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ func (r *reducer) Run(t *testing.T) {
235235
for removeProbability := 0.1; removeProbability > 1e-5 && removeProbability > 0.1/float64(len(ops)); removeProbability *= 0.5 {
236236
t.Logf("removeProbability %.2f%%", removeProbability*100.0)
237237
for i := 0; i < r.reduceAttempts; i++ {
238+
// Only try to reduce if we have more than 1 op
239+
if len(ops) <= 1 {
240+
break
241+
}
242+
238243
if o := randomSubset(t, ops, removeProbability); r.try(t, o) {
239244
ops = o
240245
// Reset the counter.

0 commit comments

Comments
 (0)