-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtyranni.tcl
321 lines (252 loc) · 6.88 KB
/
tyranni.tcl
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
#! /usr/bin/env tclsh
# tyranni.tcl
# remedial guardian sniffs for named capsules
apply {{files} {
set perch grackle.tcl
if {[file exists $perch]} {
source $perch
Grackle::guardian $files
} else {
puts stderr "$perch not found"
exit 1
}
unset perch
return
}} {syrinx.tcl}
# casework
if { false } then {
if { $argc } then {
lset argv { -verbose bels -debug 1 }
}
package require tcltest
namespace eval ::Tyranni::test {
namespace import ::tcltest::*
proc roost {unit} {
after [expr {int($unit * 1000)}]
return
}
roost 1
puts "\n\t\t| Estrilda Test |\n"
roost 1
test estrilda-1.0 {::Estrilda existence} {
namespace exists ::Estrilda
} 1
test estrilda-1.1 {surname retail} {
string tolower [Estrilda::surname]
} estrilda
test estrilda-1.15 {transits has 13 pairs} {
expr {[llength $Estrilda::transits] / 2}
} 13
test estrilda-1.2 {Estrilda::oscines existence} {
array exists Estrilda::oscines
} 1
test estrilda-1.3 {Estrilda::oscines has 84 records} {
array size Estrilda::oscines
} 84
test estrilda-1.4 {crow value ascii} -setup {
set sign n0
set crow $Estrilda::oscines($sign)
} -body {
string is ascii -strict $crow
} -cleanup {
unset crow sign
} -result 1
test estrilda-1.5 {crow string length} -setup {
set sign n0
set crow $Estrilda::oscines($sign)
} -body {
string length $crow
} -cleanup {
unset crow sign
} -result 60
test estrilda-1.6 {crow value tuple} -setup {
set sign n0
set crow $Estrilda::oscines($sign)
} -body {
string is list -strict $crow
} -cleanup {
unset crow sign
} -result 1
test estrilda-1.7 {crow list length} -setup {
set sign n0
set crow $Estrilda::oscines($sign)
} -body {
llength $crow
} -cleanup {
unset crow sign
} -result 12
test estrilda-1.8 {crow consecutive underscores} -setup {
set sign n0
set crow $Estrilda::oscines($sign)
} -body {
string match *\x5f\x5f* $crow
} -cleanup {
unset crow sign
} -result 1
test estrilda-1.9 {signboard passed nothing} {
Estrilda::signboard
} {}
test estrilda-2.0 {signboard passed empty tuple} {
Estrilda::signboard {}
} {}
test estrilda-2.1 {signboard passed inhabited tuple} -setup {
set clefs [array names Estrilda::oscines]
} -body {
Estrilda::signboard $clefs
} -cleanup {
unset clefs
} -result {}
test estrilda-2.2 {research valueless} {
Estrilda::research {0}
} {}
test estrilda-2.3 {research matchless} -setup {
set clefs [array names Estrilda::oscines]
} -body {
Estrilda::research $clefs 99
} -cleanup {
unset clefs
} -result {}
test estrilda-2.4 {research matches} -setup {
set clefs [array names Estrilda::oscines]
set sign k2j5
} -body {
Estrilda::research $clefs $sign
} -cleanup {
unset clefs sign
} -result {}
test estrilda-2.5 {place-holder} -constraints {emptyTest}
roost 1
puts "\n\t\t| Ploceus Test |\n"
roost 1
test ploceus-1.0 {::Ploceus existence} {
namespace exists ::Ploceus
} 1
test ploceus-1.1 {Ploceus::machines has 5 elements} {
llength $Ploceus::machines
} 5
test ploceus-1.2 {matallic is ascii} {
string is ascii -strict $Ploceus::metallic
} 1
test ploceus-1.3 {matallic is boolean} {
string is boolean -strict $Ploceus::metallic
} 1
test ploceus-1.4 {matallic is false} {
string is digit -strict $Ploceus::sequence
} 1
test ploceus-1.5 {sequence is digit} {
string is double -strict $Ploceus::sequence
} 1
test ploceus-1.6 {sequence is number} {
expr {0 < $Ploceus::sequence}
} 1
test ploceus-1.7 {tributes existence} {
array exists Ploceus::tributes
} 1
test ploceus-1.8 {tributes has 4 records} {
array size Ploceus::tributes
} 4
test ploceus-1.9 {utensils existence} {
array exists Ploceus::utensils
} 1
test ploceus-2.0 {utensils has 17 records} {
array size Ploceus::utensils
} 17
puts ""
test ploceus-2.1 {fingerboard returns null} -setup {
set harp beadgcf
set sign k2j6
} -body {
Ploceus::fingerboard $harp $sign
} -cleanup {
unset harp sign
} -result {}
puts ""
test ploceus-2.2 {place-holder} -constraints {emptyTest}
roost 1
puts "\n\t\t| Sturnus Test |\n"
roost 1
test sturnus-1.0 {::Sturnus existence} {
namespace exists ::Sturnus
} 1
test sturnus-1.1 {governor passed empty tuple} {
llength [Sturnus::governor {}]
} 0
test sturnus-1.2 {governor passed inhabited tuple} -setup {
set clefs [array names Estrilda::oscines]
set group [concat $clefs $clefs]
} -body {
llength [Sturnus::governor $group]
} -cleanup {
unset clefs group
} -result 128 ;# default parameter value
test sturnus-1.3 {governor passed tuple and max value} -setup {
set clefs [array names Estrilda::oscines]
set group [concat $clefs $clefs]
} -body {
llength [Sturnus::governor $group [llength $clefs]]
} -cleanup {
unset clefs group
} -result [llength [array names Estrilda::oscines]]
test sturnus-1.4 {sentinel passed empty tuple} {
llength [Sturnus::sentinel {}]
} 0
test sturnus-1.5 {sentinel passed inhabited tuple} -setup {
set clefs [array names Estrilda::oscines]
set group [lsort $clefs]
} -body {
string length [lindex [Sturnus::sentinel $group] end-2]
} -cleanup {
unset clefs group
} -result 5
test sturnus-1.6 {sentinel passed tuple and max value} -setup {
set clefs [array names Estrilda::oscines]
set group [lsort $clefs]
set maxel 1
} -body {
string length [lindex [Sturnus::sentinel $group $maxel] end-2]
} -cleanup {
unset clefs group maxel
} -result 2
test sturnus-1.7 {examples passed empty tuple} {
Sturnus::examples
} ok
test sturnus-1.8 {examples passed inhabited tuple} {
Sturnus::examples $Ploceus::machines
} ok
test sturnus-1.9 {place-holder} -constraints {emptyTest}
roost 1
puts "\n\t\t| Syrinx Test |\n"
roost 1
test syrinx-1.0 {::Syrinx existence} {
namespace exists ::Syrinx
} 1
test syrinx-1.1 {Syrinx dateline returns iso-8601 timestamp} {
regexp {^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$} [Syrinx::dateline]
} 1
test syrinx-1.2 {Syrinx compendia returns null} -setup {
set harp beadgcf
set kids {n0 k9 k6}
} -body {
Syrinx::compendia $harp $kids
} -cleanup {
unset harp kids
} -result {}
test syrinx-1.3 {Syrinx atrium passed nothing returns null} {
Syrinx::atrium
} {}
test syrinx-1.4 {Syrinx atrium passed tuple returns null} -setup {
set argots {beadgcf j3 j9 j6}
} -body {
Syrinx::atrium $argots
} -cleanup {
unset argots
} -result {}
test syrinx-1.5 {place-holder} -constraints {emptyTest}
puts [string repeat " ~" 36]
foreach moniker {::Syrinx ::Sturnus ::Ploceus ::Estrilda} {
namespace delete $moniker
}
cleanupTests
} ;# close Tyranni::test
namespace delete ::Tyranni::test
} ;# casework