12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #!/bin/sh
- #
- # Run generator tests
- #
- # Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
- # License: GPLv3+
- #####
- input=tests/parser/output
- output=tests/generator/output
- log=test-generator.log
- rm -f $log
- ret=0
- run_test ()
- {
- base="$1"
- echo "$base: " >>$log
- tmp=test-generator-$base.tmp
- timeout 5s ./generator < "$input/$base.out" >$tmp 2>/dev/null
- if diff -Naub $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 assign
- run_test choice
- run_test big-choice
- run_test else
- run_test expr
- 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
|