-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo03.py
122 lines (101 loc) · 2.45 KB
/
demo03.py
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
110
111
112
113
114
115
116
#!/bin/sh
test=`./python2perl.pl examples/1/answer0.py | perl`
if [ $test = 42 ]; then
echo 'Passes answer0.py'
else
echo 'Fails answer0.py'
fi
test=`./python2perl.pl examples/1/answer1.py | perl`
if [ $test = 42 ]; then
echo 'Passes answer1.py'
else
echo 'Fails answer1.py'
fi
test=`./python2perl.pl examples/1/answer2.py | perl`
if [ $test = 42 ]; then
echo 'Passes answer2.py'
else
echo 'Fails answer2.py'
fi
test=`./python2perl.pl examples/1/answer3.py | perl`
if [ $test = 42 ]; then
echo 'Passes answer3.py'
else
echo 'Fails answer3.py'
fi
test=`./python2perl.pl examples/1/answer4.py | perl`
if [ $test = 42 ]; then
echo 'Passes answer4.py'
else
echo 'Fails answer4.py'
fi
test=`./python2perl.pl examples/2/answer5.py | perl`
if [ $test = 42 ]; then
echo 'Passes answer5.py'
else
echo 'Fails answer5.py'
fi
test=`./python2perl.pl examples/2/answer6.py | perl`
if [ $test = 42 ]; then
echo 'Passes answer6.py'
else
echo 'Fails answer6.py'
fi
./python2perl.pl examples/2/iota.py | perl > test1
cat examples/2/iota.py | python > test2
diff test1 test2
if test "$?" -ne 0; then
echo "Test Failed!"
else
echo "Passes iota.py"
fi
./python2perl.pl examples/3/five.py | perl > test1
cat examples/3/five.py | python > test2
diff test1 test2
if test "$?" -ne 0; then
echo "Test Failed!"
else
echo "Passes five.py"
fi
test=`./python2perl.pl examples/3/prime0.py | perl`
if [ $test = 25 ]; then
echo 'Passes prime0.py '
fi
test=`./python2perl.pl examples/3/prime1.py | perl`
if [ $test = 25 ]; then
echo 'Passes prime1.py '
fi
./python2perl.pl examples/3/tetrahedral.py | perl > test1
cat examples/3/tetrahedral.py | python > test2
diff test1 test2
if test "$?" -ne 0; then
echo "Test Failed!"
else
echo "Passes tetrahedral.py"
fi
./python2perl.pl examples/3/triangle.py | perl > test1
cat examples/3/triangle.py | python > test2
diff test1 test2
if test "$?" -ne 0; then
echo "Test Failed!"
else
echo "Passes triangle.py"
fi
./python2perl.pl examples/4/line_count.1.py > test_script.pl
./test_script.pl < python2perl.pl >test1
python examples/4/line_count.1.py <python2perl.pl >test2
diff test1 test2
if test "$?" -ne 0; then
echo "Test Failed!"
else
echo "Passes line_count.1.py"
fi
./python2perl.pl examples/4/reverse_lines.0.py > test_script.pl
./test_script.pl < python2perl.pl > test1
python examples/4/reverse_lines.0.py < python2perl.pl > test2
diff test1 test2
if test "$?" -ne 0; then
echo "Test Failed!"
else
echo "Passes reverse_lines.0.py"
fi