-
Notifications
You must be signed in to change notification settings - Fork 0
/
TEST.sh
executable file
·175 lines (162 loc) · 3.21 KB
/
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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash
exitif ()
{
if [ "$?" -gt "0" ]
then
exit $?
else
echo " "
fi
}
test_help ()
{
echo " "
echo "Valid args: help, syn(tax), val(idator), tab(ulator), op(erator), def(ault), all"
echo " "
echo " help what you are looking at"
echo " syn run the unit tests for the Tabulator Syntax Checker"
echo " val run the unit tests for the Tabulator Validator"
echo " tab run the unit tests for the Tabulator Core"
echo " op run the unit tests for the Tabulator Operator"
echo " def run a default set of tests"
echo " def0 run the default tests to step 0 (load JD/ED)"
echo " def1 run the default tests to step 1 (load CC1)"
echo " def2 run the default tests to step 2 (load CC2)"
echo " def3 run the default tests to step 3 (load CC3)"
echo " all run all the tests"
echo "<none> run all the unit tests"
echo " "
}
test_syn ()
{
echo "ruby -I . test/syntax_checker_test.rb"
ruby -I . test/syntax_checker_test.rb
exitif
}
test_tab ()
{
echo "ruby -I . test/tabulator_test.rb"
ruby -I . test/tabulator_test.rb
exitif
}
test_val ()
{
echo "ruby -I . test/validator_test.rb"
ruby -I . test/validator_test.rb
exitif
}
test_op ()
{
echo "ruby -I . test/operator_test.rb"
ruby -I . test/operator_test.rb
exitif
}
test_def ()
{
echo "ruby operator.rb reset"
ruby operator.rb reset
exitif
echo "ruby operator.rb load data/Tests/Default/JD.yml data/Tests/Default/ED.yml OK"
ruby operator.rb load data/Tests/Default/JD.yml data/Tests/Default/ED.yml OK
exitif
echo "ruby operator.rb add data/Tests/Default/CC1.yml"
ruby operator.rb add data/Tests/Default/CC1.yml
exitif
echo "ruby operator.rb add data/Tests/Default/CC2.yml"
ruby operator.rb add data/Tests/Default/CC2.yml
exitif
echo "ruby operator.rb add data/Tests/Default/CC3.yml"
ruby operator.rb add data/Tests/Default/CC3.yml
exitif
}
test_def0 ()
{
echo "ruby operator.rb reset"
ruby operator.rb reset
exitif
echo "ruby operator.rb load data/Tests/Default/JD.yml data/Tests/Default/ED.yml OK"
ruby operator.rb load data/Tests/Default/JD.yml data/Tests/Default/ED.yml OK
exitif
}
test_def1 ()
{
test_def0
echo "ruby operator.rb add data/Tests/Default/CC1.yml"
ruby operator.rb add data/Tests/Default/CC1.yml
exitif
}
test_def2 ()
{
test_def1
echo "ruby operator.rb add data/Tests/Default/CC2.yml"
ruby operator.rb add data/Tests/Default/CC2.yml
exitif
}
test_unit ()
{
test_syn
test_val
test_tab
test_op
echo -e "!! ALL TABULATOR UNIT TESTS SUCCESSFUL !!\n"
exit
}
test_all ()
{
test_syn
test_val
test_tab
test_op
test_def
echo -e "!! ALL TABULATOR TESTS SUCCESSFUL !!\n"
exit
}
if [ "$#" -eq 0 ]
then
test_unit
exit 0
fi
case $1 in
all*)
test_all
exit
;;
syn*)
test_syn
exit
;;
val*)
test_val
exit
;;
tab*)
test_tab
exit
;;
op*)
test_op
exit
;;
def0*)
test_def0
exit
;;
def1*)
test_def1
exit
;;
def2*)
test_def2
exit
;;
def*)
test_def
exit
;;
h*)
test_help
exit
;;
esac
echo "Invalid argument, try this: help"
exit 1