-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSuite2.bash
More file actions
36 lines (31 loc) · 806 Bytes
/
Copy pathTestSuite2.bash
File metadata and controls
36 lines (31 loc) · 806 Bytes
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
#!/bin/bash
if [ "${#}" != "2" ]; then
echo "Error - incorrect number of args" >> /dev/stderr
exit 1
fi
for word in $(cat "${1}"); do
if ! [ -r "${word}.out" ]; then
echo "Error - ${word}.out is unreadable/doesn't exist" >> /dev/stderr
exit 1
fi
A=$(cat "${word}.in")
B=$(cat "empty.txt")
# X=$(cat "${word}.args")
Y=$(cat "${word}.out")
"./${2}" < "${word}.in" > "${word}.actual" #2> /dev/null
Z=$(cat "${word}.actual")
if [ "$Z" != "$Y" ]; then
echo "Test failed:" "${word}"
#echo "Args: ${X}"
#echo "Input: ${A}"
echo "Expected: ${Y}"
echo "Actual: ${Z}"
else
if [ "$Z" == "$B" ]; then
echo "Test Passed:" "${word}" "(ERROR)"
else
echo "Test Passed:" "${word}"
fi
fi
echo "--------------------------------------------------------------"
done