1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #!/bin/sh
- #
- # Run interpreter tests
- #
- # Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
- # License: GPLv3+
- #####
- input=tests/generator/output
- output=tests/interpreter/output # output should be the same
- log=test-vm.log
- rm -f $log
- ret=0
- run_test ()
- {
- base="$1"
- echo "$base: " >>$log
- tmp=test-vm-$base.tmp
- timeout 5s ./vm < "$input/$base.out" >$tmp 2>/dev/null
- if diff -Nau $output/$base.out $tmp >>$log; then
- printf "$base: PASS\n\n" >>$log
- else
- printf "$base: FAIL\n\n" >>$log
- ret=1
- fi
- rm $tmp
- }
- run_test choice
- run_test big-choice
- run_test else
- run_test print
- run_test test-case-1
- run_test test-case-2
- run_test test-case-4
- run_test count
- run_test 100_doors
- run_test negative
- run_test deep
- run_test gcd
- run_test factorial
- run_test fibonacci
- run_test fizzbuzz
- run_test 99bottles
- run_test primes
- run_test mandelbrot
- exit $ret
|