3 # Copyright © 2012 Nick Bowler
5 # Randomized tests that libcdecl can parse its own output.
7 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
8 # This is free software: you are free to do what the fuck you want to.
9 # There is NO WARRANTY, to the extent permitted by law.
11 : "${RANDOMSEED=$RANDOM}" "${TESTITER=500}"
13 randomdecl=test/randomdecl$EXEEXT
14 crossparse=test/crossparse$EXEEXT
15 test -x $randomdecl || exit 77
23 count=`expr $count + 1`
24 $crossparse "$decl" || { result=fail
25 printf 'original input: %s\n' "$decl" 1>&2
34 printf '%s: randomized test using RANDOMSEED=%d\n' "$0" "$RANDOMSEED"
37 { $randomdecl -s "$RANDOMSEED" -n "$TESTITER" 3>&-
38 echo gen_status=$? >&3
42 expected_count=`expr "$TESTITER" + 0`
43 if test x"$count" != x"$expected_count"; then
44 printf '%s: failed after %d successful tests (out of %d)\n' \
45 "$0" "$count" "$expected_count" 1>&2
49 test x"$result" = x"pass" && test x"$gen_status" = x"0" && exit 0