-
Notifications
You must be signed in to change notification settings - Fork 0
/
test02.sh
74 lines (47 loc) · 1.32 KB
/
test02.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
#!/bin/dash
# testing subset 0 - command d
# TEST 2.1 #
reference=$(seq 20 70 | 2041 speed '43d')
program=$(seq 20 70 | ./speed.pl '43d')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 2.1 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 2.1 FAILED\033[0m\n"
fi
# TEST 2.2 #
reference=$(seq 1 50 | 2041 speed 'd')
program=$(seq 1 50 | ./speed.pl 'd')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 2.2 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 2.2 FAILED\033[0m\n"
fi
# TEST 2.3 #
reference=$(seq 1000 3000 | 2041 speed '/^2/d')
program=$(seq 1000 3000 | ./speed.pl '/^2/d')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 2.3 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 2.3 FAILED\033[0m\n"
fi
# TEST 2.4 #
reference=$(seq 100 500 | 2041 speed '/[0-9]{3}/d')
program=$(seq 100 500 | ./speed.pl '/[0-9]{3}/d')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 2.4 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 2.4 FAILED\033[0m\n"
fi
# TEST 2.5 #
reference=$(seq 100 500 | 2041 speed '700d')
program=$(seq 100 500 | ./speed.pl '700d')
if test "$reference" = "$program"
then
printf '%b' "\033[32;1mTEST 2.5 PASSED\033[0m\n"
else
printf '%b' "\033[31;1mTEST 2.5 FAILED\033[0m\n"
fi