diff options
Diffstat (limited to 'tests/gsm0408')
-rw-r--r-- | tests/gsm0408/gsm0408_test.c | 58 | ||||
-rw-r--r-- | tests/gsm0408/gsm0408_test.ok | 91 |
2 files changed, 149 insertions, 0 deletions
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c index 479b3710..2a0e661e 100644 --- a/tests/gsm0408/gsm0408_test.c +++ b/tests/gsm0408/gsm0408_test.c @@ -238,6 +238,16 @@ static struct gprs_ra_id test_ra_cap_items[] = { .mnc = 0, .lac = 0, .rac = 0, + .mnc_3_digits = false, + /* expecting 000-00, BCD = 00 f0 00 */ + }, + { + .mcc = 0, + .mnc = 0, + .lac = 0, + .rac = 0, + .mnc_3_digits = true, + /* expecting 000-000, BCD = 00 00 00 */ }, { .mcc = 999, @@ -245,6 +255,54 @@ static struct gprs_ra_id test_ra_cap_items[] = { .lac = 65535, .rac = 255, }, + { + .mcc = 1, + .mnc = 2, + .lac = 23, + .rac = 42, + .mnc_3_digits = false, + /* expecting 001-02, BCD = 00 f1 20 */ + }, + { + .mcc = 1, + .mnc = 2, + .lac = 23, + .rac = 42, + .mnc_3_digits = true, + /* expecting 001-002, BCD = 00 21 00 */ + }, + { + .mcc = 12, + .mnc = 34, + .lac = 56, + .rac = 78, + .mnc_3_digits = false, + /* expecting 012-34, BCD = 10 f2 43 */ + }, + { + .mcc = 12, + .mnc = 34, + .lac = 23, + .rac = 42, + .mnc_3_digits = true, + /* expecting 012-034, BCD = 10 42 30 */ + }, + { + .mcc = 123, + .mnc = 456, + .lac = 23, + .rac = 42, + .mnc_3_digits = false, + /* expecting 123-456, BCD = 21 63 54 (false flag has no effect) */ + }, + { + .mcc = 123, + .mnc = 456, + .lac = 23, + .rac = 42, + .mnc_3_digits = true, + /* expecting 123-456, BCD = 21 63 54 (same) */ + }, }; static void test_ra_cap(void) diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok index a0e2c234..c1d6a701 100644 --- a/tests/gsm0408/gsm0408_test.ok +++ b/tests/gsm0408/gsm0408_test.ok @@ -18,10 +18,45 @@ MCC+MNC in BCD: 00 f0 00 000-00-0-0 RA test...passed Constructed RA: +000-000-0-0 (3-digit MNC) +MCC+MNC in BCD: 00 00 00 +000-000-0-0 (3-digit MNC) +RA test...passed +Constructed RA: 999-999-65535-255 MCC+MNC in BCD: 99 99 99 999-999-65535-255 (3-digit MNC) RA test...passed +Constructed RA: +001-02-23-42 +MCC+MNC in BCD: 00 f1 20 +001-02-23-42 +RA test...passed +Constructed RA: +001-002-23-42 (3-digit MNC) +MCC+MNC in BCD: 00 21 00 +001-002-23-42 (3-digit MNC) +RA test...passed +Constructed RA: +012-34-56-78 +MCC+MNC in BCD: 10 f2 43 +012-34-56-78 +RA test...passed +Constructed RA: +012-034-23-42 (3-digit MNC) +MCC+MNC in BCD: 10 42 30 +012-034-23-42 (3-digit MNC) +RA test...passed +Constructed RA: +123-456-23-42 +MCC+MNC in BCD: 21 63 54 +123-456-23-42 (3-digit MNC) +RA test...passed +Constructed RA: +123-456-23-42 (3-digit MNC) +MCC+MNC in BCD: 21 63 54 +123-456-23-42 (3-digit MNC) +RA test...passed - gsm48_generate_lai() from 077-121-666-0 Encoded 70 17 21 02 9a gsm48_decode_lai() gives 077-121-666-0 @@ -46,6 +81,14 @@ RA test...passed Encoded 00 f0 00 00 00 gsm48_decode_lai2() gives 000-00-0 passed +- gsm48_generate_lai() from 000-000-0-0 (3-digit MNC) + Encoded 00 f0 00 00 00 + gsm48_decode_lai() gives 000-00-0-0 + passed +- gsm48_generate_lai2() from 000-000-0 (3-digit MNC) + Encoded 00 00 00 00 00 + gsm48_decode_lai2() gives 000-000-0 (3-digit MNC) + passed - gsm48_generate_lai() from 999-999-65535-0 Encoded 99 99 99 ff ff gsm48_decode_lai() gives 999-999-65535-0 @@ -54,3 +97,51 @@ RA test...passed Encoded 99 99 99 ff ff gsm48_decode_lai2() gives 999-999-65535 (3-digit MNC) passed +- gsm48_generate_lai() from 001-02-23-0 + Encoded 00 f1 20 00 17 + gsm48_decode_lai() gives 001-02-23-0 + passed +- gsm48_generate_lai2() from 001-02-23 + Encoded 00 f1 20 00 17 + gsm48_decode_lai2() gives 001-02-23 + passed +- gsm48_generate_lai() from 001-002-23-0 (3-digit MNC) + Encoded 00 f1 20 00 17 + gsm48_decode_lai() gives 001-02-23-0 + passed +- gsm48_generate_lai2() from 001-002-23 (3-digit MNC) + Encoded 00 21 00 00 17 + gsm48_decode_lai2() gives 001-002-23 (3-digit MNC) + passed +- gsm48_generate_lai() from 012-34-56-0 + Encoded 10 f2 43 00 38 + gsm48_decode_lai() gives 012-34-56-0 + passed +- gsm48_generate_lai2() from 012-34-56 + Encoded 10 f2 43 00 38 + gsm48_decode_lai2() gives 012-34-56 + passed +- gsm48_generate_lai() from 012-034-23-0 (3-digit MNC) + Encoded 10 f2 43 00 17 + gsm48_decode_lai() gives 012-34-23-0 + passed +- gsm48_generate_lai2() from 012-034-23 (3-digit MNC) + Encoded 10 42 30 00 17 + gsm48_decode_lai2() gives 012-034-23 (3-digit MNC) + passed +- gsm48_generate_lai() from 123-456-23-0 + Encoded 21 63 54 00 17 + gsm48_decode_lai() gives 123-456-23-0 + passed +- gsm48_generate_lai2() from 123-456-23 + Encoded 21 63 54 00 17 + gsm48_decode_lai2() gives 123-456-23 (3-digit MNC) + passed +- gsm48_generate_lai() from 123-456-23-0 (3-digit MNC) + Encoded 21 63 54 00 17 + gsm48_decode_lai() gives 123-456-23-0 + passed +- gsm48_generate_lai2() from 123-456-23 (3-digit MNC) + Encoded 21 63 54 00 17 + gsm48_decode_lai2() gives 123-456-23 (3-digit MNC) + passed |