-
Notifications
You must be signed in to change notification settings - Fork 0
/
test04.sh
98 lines (65 loc) · 1.89 KB
/
test04.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
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
#!/bin/dash
# testing subset 0 - all commands with -n
# TEST 4.1 #
reference=$(seq 20 43 | 2041 speed -n '5q')
program=$(seq 20 43 | ./speed.pl -n '5q')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 4.1 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 4.1 FAILED\033[0m\n"
fi
# TEST 4.2 #
reference=$(seq 20 70 | 2041 speed -n '43p')
program=$(seq 20 70 | ./speed.pl -n '43p')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 4.2 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 4.2 FAILED\033[0m\n"
fi
# TEST 4.3 #
reference=$(seq 20 70 | 2041 speed -n '/5{2}/p')
program=$(seq 20 70 | ./speed.pl -n '/5{2}/p')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 4.3 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 4.3 FAILED\033[0m\n"
fi
# TEST 4.4 #
reference=$(seq 20 70 | 2041 speed -n '/.8$/p')
program=$(seq 20 70 | ./speed.pl -n '/.8$/p')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 4.4 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 4.4 FAILED\033[0m\n"
fi
# TEST 4.5 #
reference=$(seq 20 70 | 2041 speed -n '43d')
program=$(seq 20 70 | ./speed.pl -n '43d')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 4.5 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 4.5 FAILED\033[0m\n"
fi
# TEST 4.6 #
reference=$(seq 1 100 | 2041 speed -n 's/[1-9]/haha/')
program=$(seq 1 100 | ./speed.pl -n 's/[1-9]/haha/')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 4.6 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 4.6 FAILED\033[0m\n"
fi
# TEST 3.6 #
reference=$(seq 200 400 | 2041 speed -n '/^.*00$/s/00/**/')
program=$(seq 200 400 | ./speed.pl -n '/^.*00$/s/00/**/')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 4.7 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 4.7 FAILED\033[0m\n"
fi