about summary refs log tree commit diff stats
path: root/test_apps
diff options
context:
space:
mode:
Diffstat (limited to 'test_apps')
-rwxr-xr-xtest_apps134
1 files changed, 21 insertions, 113 deletions
diff --git a/test_apps b/test_apps
index 91929b6d..ed7350e4 100755
--- a/test_apps
+++ b/test_apps
@@ -307,129 +307,37 @@ test `uname` = 'Linux'  &&  {
   echo
 }
 
-echo "== translating using SubX"
-
-# example programs
-
-echo ex1
-test $EMULATED  &&  {
-  cat examples/ex1.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex1 -
-}
-test $NATIVE  &&  {
-  cat examples/ex1.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex1 -
-}
-
-echo ex2
-test $EMULATED  &&  {
-  cat examples/ex2.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex2 -
-}
-test $NATIVE  &&  {
-  cat examples/ex2.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex2 -
-}
-
-echo ex3
-test $EMULATED  &&  {
-  cat examples/ex3.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex3 -
-}
-test $NATIVE  &&  {
-  cat examples/ex3.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex3 -
-}
-
-echo ex4
-test $EMULATED  &&  {
-  cat examples/ex4.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex4 -
-}
-test $NATIVE  &&  {
-  cat examples/ex4.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex4 -
-}
-
-echo ex5
-test $EMULATED  &&  {
-  cat examples/ex5.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex5 -
-}
-test $NATIVE  &&  {
-  cat examples/ex5.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex5 -
-}
-
-echo ex6
-test $EMULATED  &&  {
-  cat examples/ex6.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex6 -
-}
-test $NATIVE  &&  {
-  cat examples/ex6.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex6 -
-}
-
-echo ex7
-test $EMULATED  &&  {
-  cat examples/ex7.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex7 -
-}
-test $NATIVE  &&  {
-  cat examples/ex7.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex7 -
-}
-
-echo ex8
-test $EMULATED  &&  {
-  cat examples/ex8.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex8 -
-}
-test $NATIVE  &&  {
-  cat examples/ex8.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex8 -
-}
-
-echo ex9
-test $EMULATED  &&  {
-  cat examples/ex9.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex9 -
-}
-test $NATIVE  &&  {
-  cat examples/ex9.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex9 -
-}
-
-echo ex10
-test $EMULATED  &&  {
-  cat examples/ex10.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex10 -
-}
-test $NATIVE  &&  {
-  cat examples/ex10.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex10 -
-}
-
 # Only native runs beyond this point. Emulated runs time out on travis-ci.org.
 test $EMULATED  &&  echo "skipping remaining runs in emulated mode"
 test $NATIVE  ||  exit 0
 
-echo ex11
-cat examples/ex11.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex11 -
+echo "== translating using SubX"
 
-echo ex12
-cat examples/ex12.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex12 -
+# example programs
+
+for n in `seq 1 12`
+do
+  echo ex$n
+  ./ntranslate examples/ex$n.subx
+  diff examples/ex$n a.elf
+done
 
 # Larger apps that use the standard library.
 
-echo factorial
-cat 0*.subx apps/factorial.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/factorial -
-echo crenshaw2-1
-cat 0*.subx apps/crenshaw2-1.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/crenshaw2-1 -
-echo crenshaw2-1b
-cat 0*.subx apps/crenshaw2-1b.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/crenshaw2-1b -
-echo handle
-cat 0*.subx apps/handle.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/handle -
+for app in factorial crenshaw2-1 crenshaw2-1b handle
+do
+  echo $app
+  ./ntranslate 0*.subx apps/$app.subx
+  diff apps/$app a.elf
+done
 
 # Phases of the self-hosted SubX translator.
 
-echo hex
-cat 0*.subx apps/subx-common.subx apps/hex.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/hex -
-echo survey
-cat 0*.subx apps/subx-common.subx apps/survey.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/survey -
-echo pack
-cat 0*.subx apps/subx-common.subx apps/pack.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/pack -
-echo assort
-cat 0*.subx apps/subx-common.subx apps/assort.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/assort -
-echo dquotes
-cat 0*.subx apps/subx-common.subx apps/dquotes.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/dquotes -
-echo tests
-cat 0*.subx apps/subx-common.subx apps/tests.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/tests -
-
-# Higher-level syntax.
-
-echo desugar
-cat 0*.subx apps/subx-common.subx apps/desugar.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/desugar -
+for app in hex survey pack assort dquotes tests desugar
+do
+  echo $app
+  ./ntranslate 0*.subx apps/subx-common.subx apps/$app.subx
+  diff apps/$app a.elf
+done
 
 exit 0