summaryrefslogtreecommitdiffstats
path: root/tests/gsm0808/gsm0808_test.ok
blob: 58bc5099184b8c7fc9e9faf55adfc3ab4bb7d1ba (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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
Testing generation of GSM0808 messages
Testing creating Layer3
Testing creating Layer3 (AoIP)
Testing creating Reset
Testing creating Reset Ack
Testing creating Clear Command
Testing creating Clear Complete
Testing creating Chipher Mode Command
Testing creating Cipher Complete
Testing creating Cipher Reject
Testing creating CM U
Testing creating SAPI Reject
Testing creating Assignment Request
Testing creating Assignment Complete
Testing creating Assignment Complete (AoIP)
Testing creating Assignment Failure
Testing creating Assignment Failure (AoIP)
Testing creating Clear Request
Testing creating Paging Request
Testing creating DTAP
Testing prepend DTAP
test_gsm0808_enc_dec_cell_id_list_lac: encoded: 1a 07 05 01 24 ab cd 56 78 (rc = 9)
------- test_cell_id_list_add
     cell_id_list == CGI[0]:{}
gsm0808_cell_id_list_add(&cil, &lac1) --> rc = 1
     cell_id_list == LAC[1]:{123}
gsm0808_cell_id_list_add(&cil, &lac1) --> rc = 0
     cell_id_list == LAC[1]:{123}
gsm0808_cell_id_list_add(&cil, &lac2) --> rc = 2
     cell_id_list == LAC[3]:{123, 456, 789}
gsm0808_cell_id_list_add(&cil, &lac2) --> rc = 0
     cell_id_list == LAC[3]:{123, 456, 789}
gsm0808_cell_id_list_add(&cil, &cil) --> rc = 0
     cell_id_list == LAC[3]:{123, 456, 789}
gsm0808_cell_id_list_add(&cil, &cgi1) --> rc = -22
     cell_id_list == LAC[3]:{123, 456, 789}
* can't add to BSS list
     cell_id_list == BSS[0]
gsm0808_cell_id_list_add(&cil, &lac1) --> rc = -22
     cell_id_list == BSS[0]
* other types (including NO_CELL) take on new type iff empty
     cell_id_list == NO-CELL[0]
gsm0808_cell_id_list_add(&cil, &cgi1) --> rc = 1
     cell_id_list == CGI[1]:{001-02-3-4}
gsm0808_cell_id_list_add(&cil, &cgi1) --> rc = 0
     cell_id_list == CGI[1]:{001-02-3-4}
gsm0808_cell_id_list_add(&cil, &cgi2) --> rc = 2
     cell_id_list == CGI[3]:{001-02-3-4, 001-002-3-4, 005-006-7-8}
gsm0808_cell_id_list_add(&cil, &cgi2) --> rc = 0
     cell_id_list == CGI[3]:{001-02-3-4, 001-002-3-4, 005-006-7-8}
* test gsm0808_cell_id_list_name_buf()'s return val
  strlen(gsm0808_cell_id_list_name(cil)) == 45
  gsm0808_cell_id_list_name_buf(buf, 46, cil)) == 45 "CGI[3]:{001-02-3-4, 001-002-3-4, 005-006-7-8}"
  gsm0808_cell_id_list_name_buf(buf, 23, cil)) == 45 "CGI[3]:{001-02-3-4, 00"
  gsm0808_cell_id_list_name_buf(buf, 11, cil)) == 45 "CGI[3]:{00"
  gsm0808_cell_id_list_name_buf(buf, 5, cil)) == 45 "CGI["
  gsm0808_cell_id_list_name_buf(buf, 2, cil)) == 45 "C"
  gsm0808_cell_id_list_name_buf(buf, 1, cil)) == 45 ""
  gsm0808_cell_id_list_name_buf(buf, 0, cil)) == 45 "#"
* list-full behavior
cil.id_list_len = 126
gsm0808_cell_id_list_add(&cil, &cgi2a) --> rc = 1
cil.id_list_len = 127
cil.id_list_len = 126
gsm0808_cell_id_list_add(&cil, &cgi3) --> rc = -28
cil.id_list_len = 127
gsm0808_cell_id_list_add(&cil, &cgi2a) --> rc = -28
cil.id_list_len = 127
------- test_cell_id_list_add done
test_gsm0808_enc_dec_cell_id_lac: encoded: 05 03 05 01 24 (rc = 5)
test_gsm0808_enc_dec_cell_id_bss: encoded: 05 01 06 (rc = 3)
test_gsm0808_enc_dec_cell_id_no_cell: encoded: 05 01 03 (rc = 3)
test_gsm0808_enc_dec_cell_id_lai_and_lac: encoded: 05 06 04 21 63 54 23 42 (rc = 8)
test_gsm0808_enc_dec_cell_id_ci: encoded: 05 03 02 04 23 (rc = 5)
test_gsm0808_enc_dec_cell_id_lac_and_ci: encoded: 05 05 01 04 23 02 35 (rc = 7)
test_gsm0808_enc_dec_cell_id_global: encoded: 05 08 00 21 63 54 23 42 04 23 (rc = 10)
Testing gsm0808_sc_cfg_from_gsm48_mr_cfg():
Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 0000 = 0b0000000000000000
Result (hr):
 S15-S0 = 0000 = 0b0000000000000000

Input:
 m4_75= 1   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 5703 = 0b0101011100000011
Result (hr):
 S15-S0 = 0703 = 0b0000011100000011

Input:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 0000 = 0b0000000000000000
Result (hr):
 S15-S0 = 0000 = 0b0000000000000000

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 1   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 5706 = 0b0101011100000110
Result (hr):
 S15-S0 = 0706 = 0b0000011100000110

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 1   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 1608 = 0b0001011000001000
Result (hr):
 S15-S0 = 0608 = 0b0000011000001000

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 1   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 0412 = 0b0000010000010010
Result (hr):
 S15-S0 = 0412 = 0b0000010000010010

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 1
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 4020 = 0b0100000000100000
Result (hr):
 S15-S0 = 0020 = 0b0000000000100000

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 1
 m12_2= 0
Result (fr):
 S15-S0 = 1040 = 0b0001000001000000
Result (hr):
 S15-S0 = 0000 = 0b0000000000000000

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 1
Result (fr):
 S15-S0 = 4082 = 0b0100000010000010
Result (hr):
 S15-S0 = 0002 = 0b0000000000000010

Input:
 m4_75= 1   smod=  0
 m5_15= 1   spare= 0
 m5_90= 1   icmi=  0
 m6_70= 1   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 570f = 0b0101011100001111
Result (hr):
 S15-S0 = 070f = 0b0000011100001111

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 1   ver=   0
 m7_95= 1
 m10_2= 1
 m12_2= 1
Result (fr):
 S15-S0 = 54f2 = 0b0101010011110010
Result (hr):
 S15-S0 = 0432 = 0b0000010000110010

Input:
 m4_75= 0   smod=  0
 m5_15= 0   spare= 0
 m5_90= 1   icmi=  0
 m6_70= 1   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 0
 m10_2= 1
 m12_2= 1
Result (fr):
 S15-S0 = 57ce = 0b0101011111001110
Result (hr):
 S15-S0 = 070e = 0b0000011100001110

Input:
 m4_75= 1   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 1   ver=   0
 m7_95= 1
 m10_2= 0
 m12_2= 0
Result (fr):
 S15-S0 = 5733 = 0b0101011100110011
Result (hr):
 S15-S0 = 0733 = 0b0000011100110011

Input:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  0
 m6_70= 1   nscb=  0
 m7_40= 0   ver=   0
 m7_95= 1
 m10_2= 0
 m12_2= 1
Result (fr):
 S15-S0 = 56aa = 0b0101011010101010
Result (hr):
 S15-S0 = 062a = 0b0000011000101010

Input:
 m4_75= 1   smod=  0
 m5_15= 0   spare= 0
 m5_90= 1   icmi=  0
 m6_70= 0   nscb=  0
 m7_40= 1   ver=   0
 m7_95= 0
 m10_2= 1
 m12_2= 0
Result (fr):
 S15-S0 = 5757 = 0b0101011101010111
Result (hr):
 S15-S0 = 0717 = 0b0000011100010111

Input:
 m4_75= 1   smod=  0
 m5_15= 1   spare= 0
 m5_90= 1   icmi=  0
 m6_70= 1   nscb=  0
 m7_40= 1   ver=   0
 m7_95= 1
 m10_2= 1
 m12_2= 1
Result (fr):
 S15-S0 = 57ff = 0b0101011111111111
Result (hr):
 S15-S0 = 073f = 0b0000011100111111

Testing gsm48_mr_cfg_from_gsm0808_sc_cfg():
Input:
 S15-S0 = ff03 = 0b1111111100000011
Output:
 m4_75= 1   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 0
 m10_2= 0
 m12_2= 0

Input:
 S15-S0 = 0000 = 0b0000000000000000
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 0
 m10_2= 0
 m12_2= 0

Input:
 S15-S0 = ff06 = 0b1111111100000110
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 1   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 0
 m10_2= 0
 m12_2= 0

Input:
 S15-S0 = 3e08 = 0b0011111000001000
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 1   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 0
 m10_2= 0
 m12_2= 0

Input:
 S15-S0 = 0c12 = 0b0000110000010010
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 1   ver=   1
 m7_95= 0
 m10_2= 0
 m12_2= 0

Input:
 S15-S0 = c020 = 0b1100000000100000
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 1
 m10_2= 0
 m12_2= 0

Input:
 S15-S0 = 3040 = 0b0011000001000000
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 0
 m10_2= 1
 m12_2= 0

Input:
 S15-S0 = c082 = 0b1100000010000010
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 0
 m10_2= 0
 m12_2= 1

Input:
 S15-S0 = ff4b = 0b1111111101001011
Output:
 m4_75= 1   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 1   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 0
 m10_2= 1
 m12_2= 0

Input:
 S15-S0 = fcd2 = 0b1111110011010010
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 1   ver=   1
 m7_95= 0
 m10_2= 1
 m12_2= 1

Input:
 S15-S0 = c0a2 = 0b1100000010100010
Output:
 m4_75= 0   smod=  0
 m5_15= 1   spare= 0
 m5_90= 0   icmi=  1
 m6_70= 0   nscb=  0
 m7_40= 0   ver=   1
 m7_95= 1
 m10_2= 0
 m12_2= 1

Done