annotate tests/testeval.sh @ 1315:7687412f9aef

Fix jssmod sample conversion flags storing .. urgh.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 20 Aug 2017 01:54:54 +0300
parents a20f127e6e1b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
689
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #!/bin/sh
715
a20f127e6e1b Fix path to evaltest binary.
Matti Hamalainen <ccr@tnsp.org>
parents: 713
diff changeset
2 ETEST="./evaltest -f -e"
689
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 CTEST=./frm
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 echo "
695
80ac5c21e07f Few more tests.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
6 2 << 1 + 9 >> 3 * 5
80ac5c21e07f Few more tests.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
7 (2 << 1 + 9) >> 3 * 5
80ac5c21e07f Few more tests.
Matti Hamalainen <ccr@tnsp.org>
parents: 692
diff changeset
8 2 << 1 + 31 >> 3 * 5
689
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 5 << 1
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 8 << 3 * 5
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 3200/2 << 5
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 3200/(2 << 5)
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 15+5/3
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 (15+5)/3
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 5*-3
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 -64 + 5 << 3 * 3 - 1
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 -64 + 5 << 3 + 3 - 1
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 3 * -1 + 5 << 1
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 7 + 3 << 2 * 3
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 7 * 3 << 4 - 3
692
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
21 127&127 + 12&3
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
22 1+3*5&7
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
23 35&3 + 2
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
24 9+5&(3 + 7)
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
25 (5*(7&3) + 1)
706
d51dbf263a59 Another testcase.
Matti Hamalainen <ccr@tnsp.org>
parents: 695
diff changeset
26 123045 >> 1 & 60
712
048df6a4b26d Add tests.
Matti Hamalainen <ccr@tnsp.org>
parents: 706
diff changeset
27 ~60
048df6a4b26d Add tests.
Matti Hamalainen <ccr@tnsp.org>
parents: 706
diff changeset
28 3 + ~5
048df6a4b26d Add tests.
Matti Hamalainen <ccr@tnsp.org>
parents: 706
diff changeset
29 -~128
048df6a4b26d Add tests.
Matti Hamalainen <ccr@tnsp.org>
parents: 706
diff changeset
30 5-~127
689
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 " | while read f; do
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 if test "x$f" != "x"; then
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 printf "#include <stdio.h>\nint main(int argc, char *argv[])\n{\n (void) argc; (void) argv;\n printf(\"%%1.5f\\\\n\", (double) (%s));\n return 0;\n}\n" "$f" > "$CTEST.c"
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 gcc -g -o "$CTEST" "$CTEST.c"
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 if test $? -eq 0; then
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 RES1=`$CTEST`
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 RES2=`$ETEST "$f"`
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 if test "$RES1" != "$RES2"; then
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 echo "---------------------------------------------"
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 echo "RESULT MISMATCH: '$f'"
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 echo " C test: $RES1"
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 echo " eval: $RES2"
692
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
43 cat "$CTEST.c"
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
44 elif test "x$1" != "x"; then
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
45 echo "---------------------------------------------"
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
46 echo "FORMULA: '$f'"
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
47 echo " C test: $RES1"
391310cfba26 Fix & precedence vs +.
Matti Hamalainen <ccr@tnsp.org>
parents: 689
diff changeset
48 echo " eval: $RES2"
689
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 fi
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 fi
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 fi
686c23d69aa2 Add testing script.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 done
713
80c3e69aa301 Don't remove the test source/binary files.
Matti Hamalainen <ccr@tnsp.org>
parents: 712
diff changeset
53 #rm -f "$CTEST" "$CTEST.c"