summaryrefslogtreecommitdiffstats
path: root/runtime/tests/pmaps/pmap.test
blob: a8f82506f6b0aec68a05aaed904a76ee2a489764 (plain)
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
package require tcltest
namespace import -force tcltest::*

cd $tcltest::testsDirectory

set CFLAGS "-Os"
set KPATH "/lib/modules/[exec uname -r]/build/include"
set MPATH "/lib/modules/[exec uname -r]/build/include/asm/mach-default"
set PATH "../../user"

test ii {Test of int64 keys and int64 values} -setup {
	puts "gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ii.c"
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ii.c
} -body {
	exec ./test
} -result {CPU #0
map[2] = 1
map[4] = 1

CPU #1
map[1] = 1
map[2] = 11
map[3] = 1
map[4] = 1

CPU #2
map[1] = 2
map[2] = 21
map[3] = 4
map[4] = 1

CPU #3
map[1] = 3
map[2] = 31
map[3] = 9
map[4] = 1

CPU #4
map[1] = 4
map[2] = 41
map[3] = 16
map[4] = 1

CPU #5
map[1] = 5
map[2] = 51
map[3] = 25
map[4] = 1

CPU #6
map[1] = 6
map[2] = 61
map[3] = 36
map[4] = 1

CPU #7
map[1] = 7
map[2] = 71
map[3] = 49
map[4] = 1

map[2] = 288
map[4] = 8
map[1] = 28
map[3] = 140
}

test is {Test of int64 keys and string values} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test is.c
} -body {
	exec ./test
} -result {CPU #0
map[1] = 0,
map[2] = 1,
map[3] = 0,
map[4] = 1,

CPU #1
map[1] = 1,
map[2] = 11,
map[3] = 1,
map[4] = 1,

CPU #2
map[1] = 2,
map[2] = 21,
map[3] = 4,
map[4] = 1,

CPU #3
map[1] = 3,
map[2] = 31,
map[3] = 9,
map[4] = 1,

CPU #4
map[1] = 4,
map[2] = 41,
map[3] = 16,
map[4] = 1,

CPU #5
map[1] = 5,
map[2] = 51,
map[3] = 25,
map[4] = 1,

CPU #6
map[1] = 6,
map[2] = 61,
map[3] = 36,
map[4] = 1,

CPU #7
map[1] = 7,
map[2] = 71,
map[3] = 49,
map[4] = 1,

map[2] = 1,11,21,31,41,51,61,71,
map[4] = 1,1,1,1,1,1,1,1,
map[1] = 0,1,2,3,4,5,6,7,
map[3] = 0,1,4,9,16,25,36,49,
}

test si {Test of string keys and int64 values} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test si.c
} -body {
	exec ./test
} -result {CPU #0
map[TWO] = 1
map[FOUR] = 1

CPU #1
map[ONE] = 1
map[TWO] = 11
map[THREE] = 1
map[FOUR] = 1

CPU #2
map[ONE] = 2
map[TWO] = 21
map[THREE] = 4
map[FOUR] = 1

CPU #3
map[ONE] = 3
map[TWO] = 31
map[THREE] = 9
map[FOUR] = 1

CPU #4
map[ONE] = 4
map[TWO] = 41
map[THREE] = 16
map[FOUR] = 1

CPU #5
map[ONE] = 5
map[TWO] = 51
map[THREE] = 25
map[FOUR] = 1

CPU #6
map[ONE] = 6
map[TWO] = 61
map[THREE] = 36
map[FOUR] = 1

CPU #7
map[ONE] = 7
map[TWO] = 71
map[THREE] = 49
map[FOUR] = 1

map[FOUR] = 8
map[TWO] = 288
map[THREE] = 140
map[ONE] = 28
}

test ix {Test of int64 keys and string values} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test ix.c
} -body {
	exec ./test
} -result {CPU #0
map[1] = count:1  sum:0  avg:0  min:0  max:0
map[2] = count:1  sum:1  avg:1  min:1  max:1
map[3] = count:1  sum:0  avg:0  min:0  max:0
map[4] = count:1  sum:1  avg:1  min:1  max:1

CPU #1
map[1] = count:1  sum:1  avg:1  min:1  max:1
map[2] = count:1  sum:11  avg:11  min:11  max:11
map[3] = count:1  sum:1  avg:1  min:1  max:1
map[4] = count:1  sum:1  avg:1  min:1  max:1

CPU #2
map[1] = count:1  sum:2  avg:2  min:2  max:2
map[2] = count:1  sum:21  avg:21  min:21  max:21
map[3] = count:1  sum:4  avg:4  min:4  max:4
map[4] = count:1  sum:1  avg:1  min:1  max:1

CPU #3
map[1] = count:1  sum:3  avg:3  min:3  max:3
map[2] = count:1  sum:31  avg:31  min:31  max:31
map[3] = count:1  sum:9  avg:9  min:9  max:9
map[4] = count:1  sum:1  avg:1  min:1  max:1

CPU #4
map[1] = count:1  sum:4  avg:4  min:4  max:4
map[2] = count:1  sum:41  avg:41  min:41  max:41
map[3] = count:1  sum:16  avg:16  min:16  max:16
map[4] = count:1  sum:1  avg:1  min:1  max:1

CPU #5
map[1] = count:1  sum:5  avg:5  min:5  max:5
map[2] = count:1  sum:51  avg:51  min:51  max:51
map[3] = count:1  sum:25  avg:25  min:25  max:25
map[4] = count:1  sum:1  avg:1  min:1  max:1

CPU #6
map[1] = count:1  sum:6  avg:6  min:6  max:6
map[2] = count:1  sum:61  avg:61  min:61  max:61
map[3] = count:1  sum:36  avg:36  min:36  max:36
map[4] = count:1  sum:1  avg:1  min:1  max:1

CPU #7
map[1] = count:1  sum:7  avg:7  min:7  max:7
map[2] = count:1  sum:71  avg:71  min:71  max:71
map[3] = count:1  sum:49  avg:49  min:49  max:49
map[4] = count:1  sum:1  avg:1  min:1  max:1

map[2] = count:8  sum:288  avg:36  min:1  max:71
value |-------------------------------------------------- count
    0 |@                                                  1
   10 |@                                                  1
   20 |@                                                  1
   30 |@                                                  1
   40 |@                                                  1
   50 |@                                                  1
   60 |@                                                  1
   70 |@                                                  1
   80 |                                                   0
   90 |                                                   0

map[4] = count:8  sum:8  avg:1  min:1  max:1
value |-------------------------------------------------- count
    0 |@@@@@@@@                                           8
   10 |                                                   0
   20 |                                                   0
   30 |                                                   0
   40 |                                                   0
   50 |                                                   0
   60 |                                                   0
   70 |                                                   0
   80 |                                                   0
   90 |                                                   0

map[1] = count:8  sum:28  avg:3  min:0  max:7
value |-------------------------------------------------- count
    0 |@@@@@@@@                                           8
   10 |                                                   0
   20 |                                                   0
   30 |                                                   0
   40 |                                                   0
   50 |                                                   0
   60 |                                                   0
   70 |                                                   0
   80 |                                                   0
   90 |                                                   0

map[3] = count:8  sum:140  avg:17  min:0  max:49
value |-------------------------------------------------- count
    0 |@@@@                                               4
   10 |@                                                  1
   20 |@                                                  1
   30 |@                                                  1
   40 |@                                                  1
   50 |                                                   0
   60 |                                                   0
   70 |                                                   0
   80 |                                                   0
   90 |                                                   0

}

test map_format {Test of map formatting and histograms} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test map_format.c
} -body {
	exec ./test
} -result {Columbus -> mapiis 1 2 Ohio
Salem -> mapiis 7 8 Oregon
Olympia -> mapiis 5 6 Washington
Sacramento -> mapiis 3 4 California

Columbus % Ohio
Salem % Oregon
Olympia % Washington
Sacramento % California

Columbus -> mapiis    
Salem -> mapiis    
Olympia -> mapiis    
Sacramento -> mapiis    

The capitol of Riga is Latvia and the nerd population is 212063400820736
The capitol of Sofia is Bulgaria and the nerd population is -2400999087387945352
The capitol of Nicosia is Cyprus and the nerd population is -1
The capitol of Valletta is Malta and the nerd population is 1

The capitol of Riga is Latvia and the nerd population is c0dedbad0000
The capitol of Sofia is Bulgaria and the nerd population is deadf00d12345678
The capitol of Nicosia is Cyprus and the nerd population is ffffffffffffffff
The capitol of Valletta is Malta and the nerd population is 1

The capitol of Riga is Latvia and the nerd population is C0DEDBAD0000
The capitol of Sofia is Bulgaria and the nerd population is DEADF00D12345678
The capitol of Nicosia is Cyprus and the nerd population is FFFFFFFFFFFFFFFF
The capitol of Valletta is Malta and the nerd population is 1

Bogons per packet for Riga
count:49600  sum:3288450  avg:66  min:0  max:99
value |-------------------------------------------------- count
    0 |@@                                                  460
   10 |@@@@@@@                                            1460
   20 |@@@@@@@@@@@@                                       2460
   30 |@@@@@@@@@@@@@@@@@@                                 3460
   40 |@@@@@@@@@@@@@@@@@@@@@@@                            4460
   50 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@                       5460
   60 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                 6460
   70 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@            7460
   80 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@       8460
   90 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  9460

Bogons per packet for Sofia
count:100  sum:2025  avg:20  min:0  max:81
value |-------------------------------------------------- count
    0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         42
   10 |@@@@@@@@@@@@@@@@@                                  17
   20 |@@@@@@@@@@@@@                                      13
   30 |@@@@@@@@@                                           9
   40 |@@@@@@@@@                                           9
   50 |@@@@                                                4
   60 |@@@                                                 3
   70 |@@                                                  2
   80 |@                                                   1
   90 |                                                    0

Bogons per packet for Valletta
count:45  sum:2850  avg:63  min:10  max:90
value |-------------------------------------------------- count
    0 |                                                   0
   10 |@                                                  1
   20 |@@                                                 2
   30 |@@@                                                3
   40 |@@@@                                               4
   50 |@@@@@                                              5
   60 |@@@@@@                                             6
   70 |@@@@@@@                                            7
   80 |@@@@@@@@                                           8
   90 |@@@@@@@@@                                          9


49600 was the count for Riga, Latvia
100 was the count for Sofia, Bulgaria
45 was the count for Valletta, Malta

mapssx[     Riga,   Latvia] = 322D82
mapssx[    Sofia, Bulgaria] = 7E9
mapssx[ Valletta,    Malta] = B22}

catch {exec rm test}

cleanupTests