forked from Ezhil-Language-Foundation/Ezhil-Lang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
executable file
·109 lines (99 loc) · 2.79 KB
/
test
File metadata and controls
executable file
·109 lines (99 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
if [ -e success.txt ];
then
rm success.txt
fi
if [ -e failed.txt ];
then
rm failed.txt
fi
touch success.txt
touch failed.txt
## run all the success programs
for i in `ls ./tests/*.prog`;
do
echo "Testing file", $i
python ./ezhil/exprs.py $i $1
if [ $? -eq 0 ]
then
echo $i >> success.txt
else
echo $i >> failed.txt
fi
sleep 0
done
# run tests for Ezhil as well
cd ./ezhil_tests
for i in hello.n fact.n ranges.n gcd.n printtest.n vannakm.n temple.n lex2.n ifchain.n fern.n கூட்டு.n strings.n tables.n calc_asmd.n list.n \
string_demo.n list_ta.n yinyang.n unaryop.n boolean.n chaos.n \
prime.n array1.n array2.n filedemo.n filerw.n reverse.n friends.n \
palindromes.n ford2.n trials.n fornested.n loopupdate.n foreach.n foriter.n \
dowhile.n select_case2.n magic_coins.n rich_poor.n peanut_candy.n logical_not.n \
binary.n fibo.n floatpthole.n ifnested.n hailstone.n split_text.n lcmgcd.n \
windoze.n convert2kelvin.n dict.n speedoflight.n tictok.n \
change.n solo_return.n listmt.n predicates.n sexpr.n dict_ta.n \
fruity.n
do
echo "Testing Ezhil script","python ../ezhil/ezhil.py $i $1"
python ../ezhil/ezhil.py $i $1
if [ $? -eq 0 ]
then
echo $i >> ../success.txt
else
echo $i >> ../failed.txt
fi
sleep 0
done
cd ../
echo "**************************************************"
echo " Running Web tests"
echo "**************************************************"
# this test needs Ezhil to be installed via pip
python ./web/ezhil_web.py
if [ $? -eq 0 ]
then
echo "ezhil_web.py" >> success.txt
else
echo "ezhil_web.py" >> failed.txt
fi
echo "**************************************************"
echo " Running all the failure programs, that must fail."
echo "**************************************************"
sleep 2
for i in `ls ./tests/*.fprog`;
do
echo "Testing file", $i
python ./ezhil/exprs.py $i $1
if [ $? -eq 0 ]
then
echo $i >> failed.txt
else
echo $i >> success.txt
fi
sleep 0
done
echo "**********Successful Tests**********"
cat success.txt
echo "*************************************"
echo "***********Failed Tests**************"
cat failed.txt
echo "***********Summary******************"
echo "Passed = "`wc -l success.txt`", Failed = "`wc -l failed.txt`
# number of failures is always limited, and when you add
# failed tests you have to bump this up.
NFAIL=7 #08/27/13 - this many
TOTFAIL=`wc -l failed.txt | cut -d' ' -f1`
#echo "assert( $TOTFAIL == $NFAIL )" | python
echo "from sys import exit; exit( $TOTFAIL != $NFAIL )" | python
if [ $? -eq 0 ]
then
echo "Expected failures"
exitcode=0 # success
else
echo "Too few/many failures; some negative tests may have failed"
exitcode=255 #failed failures < $NFAIL
fi
# cleanup
rm failed.txt
rm success.txt
exit $exitcode