-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.sh
executable file
·69 lines (47 loc) · 948 Bytes
/
test.sh
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
#!/bin/sh
# Error Counter
e=0
echo "--- Starting Test ---"
echo "======================="
echo ""
# Example 1
if ./mewmew examples/scratch.mew.txt | grep -q '300'; then
echo "[-] PASS => 1"
else
echo "[x] FAIL => 1"
e=1
fi
# Example 2
if ./mewmew examples/adddiv.mew.txt | grep -qzP '2\n4\n6\n8\n10'; then
echo "[-] PASS => 2"
else
echo "[x] FAIL => 2"
e=1
fi
# Example 3
if ./mewmew examples/factorial.mew.txt | grep -q '120'; then
echo "[-] PASS => 3"
else
echo "[x] FAIL => 3"
e=1
fi
# Example 4
if echo "10" | ./mewmew examples/stdin.mew.txt | grep -q '1e+10'; then
echo "[-] PASS => 4"
else
echo "[x] FAIL => 4"
e=1
fi
# Example 5
if ./mewmew examples/helloworld.mew.txt | grep -q 'HELLO WORLD'; then
echo "[-] PASS => 5"
else
echo "[x] FAIL => 5"
e=1
fi
echo ""
echo "--- Ending Test ---"
echo "====================="
if [ "$e" -gt 0 ]; then
exit 1
fi