One of the switch statements in declgen has completely bogus case
labels: '0', '1', ... instead of 0, 1, ...
Fix this up and also add a default: assert(0); which would have caught
this earlier. Improve the test case output when a randomdecl failure
causes the test to fail.
Also add a comment to the one switch statement in this file which
intentionally does not have a default: assert(0).
case CDECL_TYPE_IDENT:
assert(!specs->next);
specs->ident = gen_identifier(rng);
+ break;
+ default:
+ /* Nothing to be done. */
+ ;
}
return specs;
d->u.array = (struct cdecl_array){0};
switch (gsl_rng_uniform_int(rng->rng, 4)) {
- case '0':
+ case 0:
d->u.array.vla = malloc_nofail(1);
d->u.array.vla[0] = 0;
break;
- case '1':
+ case 1:
d->u.array.vla = gen_identifier(rng);
break;
- case '2':
+ case 2:
d->u.array.length = 0;
break;
- case '3':
+ case 3:
d->u.array.length = gsl_rng_uniform_int(rng->rng, -1);
break;
+ default:
+ assert(0);
}
}
} | proc >&3`
eval "$eval_cmd"
+if test x"$gen_status" != x"0"; then
+ printf '%s: %s failed with status=%d\n' \
+ "$0" "$randomdecl" "$gen_status" 1>&2
+ exit 1
+fi
+
expected_count=`expr "$TESTITER" + 0`
if test x"$count" != x"$expected_count"; then
printf '%s: failed after %d successful tests (out of %d)\n' \
exit 1
fi
-test x"$result" = x"pass" && test x"$gen_status" = x"0" && exit 0
+test x"$result" = x"pass" && exit 0
exit 1