language

some fools attempt at an interpreted language
Log | Files | Refs | README

test.sh (492B)


      1 #!/bin/bash
      2 
      3 dir=$(ls)
      4 
      5 successes=0
      6 total=0
      7 for i in $dir
      8 do
      9 	if [ "$1" == 'all' ] || [ "$1" == $i ]; then
     10 		total=$((total + 1))
     11 
     12 		cd $i
     13 		make &> /dev/null
     14 
     15 		printf "\nTESTCASE: $(basename $PWD)\n"
     16 		
     17 		if (./test | diff /dev/stdin expected_output &> /dev/null); then
     18 			printf "TESTCASE $(basename $PWD) succeeded\n"
     19 			successes=$((successes + 1))
     20 		else
     21 			printf "TESTCASE $(basename $PWD) failed\n"
     22 			printf "$output\n"
     23 		fi
     24 
     25 		cd ..
     26 	fi
     27 done
     28 
     29 printf "PASSING: $successes/$total\n"