-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoftest.lua
262 lines (204 loc) · 5.2 KB
/
softest.lua
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/usr/bin/env lua
local Softest = {}
local scribe = function(style, ...)
io.write(string.format(style, ...))
return nil
end
local tested, passed, failed = 0, 0, 0
local process = function(name, numb, okay, errs)
if okay then
scribe("%s success [%u] %s\n", name, numb, okay)
passed = passed + 1
else
scribe("%s failure [%u] %s\n", name, numb, errs)
failed = failed + 1
end
return nil
end
Softest.dispatch = function(duos)
for name, refun in pairs(duos) do
if rawequal(type(refun), 'function') then
local okay, errs = pcall(refun, nil)
if not okay then
scribe("\n\t%s: %s\n\n", name, errs)
return nil
end
else
error(name .." is not a function reference")
end
end
return nil
end
Softest.report = function()
local style = "\n\tTested: %u, Passed: %u, Failed: %u\n\n"
scribe(style, tested, passed, failed)
return nil
end
Softest.epeius = function()
local okay, errs
local name = 'epeius'
local refer = require('chromia')
local inputs = {{nil}, {'j3k56m4h'}}
local maxine = {}
for niter = 0, 99 do
table.insert(maxine, niter)
end
-- can govern amount of arguments?
table.insert(inputs, maxine)
-- can govern amount of characters?
table.insert(inputs, {'0123456789'})
for liter = 1, #inputs do
okay, errs = pcall(refer.Epeius, inputs[liter])
tested = tested + 1
process(name, liter, okay, errs)
end
return nil
end
Softest.aetolus = function()
local okay, errs
local name = 'aetolus'
local refer = require('chromia')
local values = {
{'gamut'},
{'cgdae', 'gamut'},
{'help'},
{nil},
{'group', 'yq'},
{'group', 'what'},
{'query', '^%a%dh?$'},
{'query', 'which'},
{'n0', 'k9', 'k4j7'},
{'eadgbe', 'n0', 'j8', 'z0'},
}
for liter = 1, #values do
okay, errs = pcall(refer.Aetolus, values[liter])
tested = tested + 1
process(name, liter, okay, errs)
end
return nil
end
Softest.eurycyda = function()
local okay, errs
local name = 'eurycyda'
local refer = require('asterodia')
local inputs = {'k2j17', 'k9', 'n0', 'j367', 'z0'}
for liter = 1, #inputs do
print()
okay, errs = pcall(refer.Eurycyda, inputs[liter])
tested = tested + 1
process(name, liter, okay, errs)
end
return nil
end
Softest.naxos = function()
local okay, errs
local name = 'naxos'
local refer = require('asterodia')
okay, errs = pcall(refer.Naxos, nil)
if okay then
local list = refer.Naxos()
print()
for liter = 1, #list do
scribe('\t%s', list[liter])
if (liter % 7 == 0) then print() end
end
print()
end
tested = tested + 1
process(name, 1, okay, errs)
return nil
end
Softest.paeon = function()
local okay, errs
local name = 'paeon'
local refer = require('asterodia')
local list = refer.Naxos()
okay, errs = pcall(refer.Paeon, list)
tested = tested + 1
process(name, 1, okay, errs)
return nil
end
Softest.toggle = function()
local okay, errs
local name = 'toggle'
local refer = require('asterodia')
local value = refer.toggle
local boole = rawequal(type(value), 'boolean')
okay, errs = pcall(assert, boole, 'toggle not boolean')
tested = tested + 1
process(name, 1, okay, errs)
return nil
end
Softest.morph = function()
local okay, errs
local name = 'morph'
local refer = require('asterodia')
local lyres = require('olympiad')
local value = lyres.n0
okay, errs = pcall(refer.morph, value)
tested = tested + 1
process(name, 1, okay, errs)
return nil
end
Softest.stones = function()
local okay, errs
local name = 'stones'
local refer = require('asterodia')
local tuned = refer.tuning
local value = refer.gearbox(tuned)
local boole = rawequal(type(value), 'table')
okay, errs = pcall(assert, boole, 'stones not table')
tested = tested + 1
process(name, 1, okay, errs)
return nil
end
Softest.gearbox = function()
local okay, errs
local name = 'gearbox'
local refer = require('asterodia')
local values = refer.stocks
table.insert(values, 'abcdefg') -- matchless
for liter = 1, #values do
okay, errs = pcall(refer.gearbox, values[liter])
tested = tested + 1
process(name, liter, okay, errs)
end
return nil
end
Softest.olympiad = function()
local desc, okay, errs
local name = 'olympiad'
local lyres = require(name)
local numb = 0
for clef, value in pairs(lyres) do
desc = string.format(" %s: %s \t", name, clef)
numb = numb + 1
okay, errs = pcall(assert, string.len(value) == 60)
tested = tested + 1
process(desc, numb, okay, errs)
end
return nil
end
scribe('\n\n\t\t%s\n\n', string.upper('Chromia test'))
local Chromia_test = {
epeius = Softest.epeius,
aetolus = Softest.aetolus,
}
Softest.dispatch(Chromia_test)
scribe('\n\n\t\t%s\n\n', string.upper('Asterodia test'))
local Asterodia_test = {
eurycyda = Softest.eurycyda,
naxos = Softest.naxos,
paeon = Softest.paeon,
toggle = Softest.toggle,
morph = Softest.morph,
stones = Softest.stones,
gearbox = Softest.gearbox,
}
Softest.dispatch(Asterodia_test)
scribe('\n\n\t\t%s\n\n', string.upper('Olympiad test'))
local Olympiad_test = {
olympiad = Softest.olympiad,
}
Softest.dispatch(Olympiad_test)
Softest.report()