Introduce old redir program
[lcapit-junk-code.git] / prime / test-primes
blob9e95a30637412a0abd03ec12ff7afe2169202c5b
1 #!/bin/sh
3 PRIMES_FILE=first-500.txt
4 PROGRAMS="prime.aikido prime.sh prime.py"
6 file_primes_test()
8 prog=$1
10 for num in $(cat $PRIMES_FILE); do
11 ./${prog} $num 1> /dev/null
12 if [ $? -ne 1 ]; then
13 return $num
15 done
17 return 0
20 for prog in $(echo $PROGRAMS); do
21 printf "\nTesting: $prog\n"
23 file_primes_test $prog
24 if [ $? -ne 0 ]; then
25 printf "\tprime_file FAILED for $num"
26 else
27 printf "\tprime_file PASSED\n"
29 done
31 printf "\n"