harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

run (642B)


      1 #!/bin/sh
      2 printf 'Running harec test suite at %s\n\n' "$(date)"
      3 start=$(date +"%s")
      4 
      5 ntests=0
      6 npass=0
      7 nfail=0
      8 
      9 for f in ./tests/*
     10 do
     11 	if [ -x "$f" ] && [ "$f" != "./tests/run" ]
     12 	then
     13 		ntests=$((ntests+1))
     14 		name="$(basename "$f")"
     15 		printf '%-20s ...' "$name"
     16 		if [ "$name" = "09-funcs" ]
     17 		then
     18 			expected=42
     19 		else
     20 			expected=0
     21 		fi
     22 		$f
     23 		if [ $? -eq $expected ]
     24 		then
     25 			npass=$((npass+1))
     26 			printf 'PASS\n'
     27 		else
     28 			nfail=$((nfail+1))
     29 			printf 'FAIL\n'
     30 		fi
     31 	fi
     32 done
     33 
     34 finish=$(date +"%s")
     35 printf '\n%d tests:\t%d passed\t%d failed\tin %d seconds\n' \
     36 	$ntests $npass $nfail $((finish-start))
     37 if [ $nfail -ne 0 ]
     38 then
     39 	exit 1
     40 fi