Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 1 | /* simple test for the gsm0408 formatting functions */ |
| 2 | /* |
| 3 | * (C) 2008 by Holger Hans Peter Freyther <zecke@selfish.org> |
| 4 | * All Rights Reserved |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 7 | * it under the terms of the GNU Affero General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
Harald Welte | 9af6ddf | 2011-01-01 15:25:50 +0100 | [diff] [blame] | 16 | * You should have received a copy of the GNU Affero General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <assert.h> |
| 22 | #include <stdio.h> |
| 23 | #include <stdlib.h> |
Max | 69e9c0d | 2016-05-18 13:04:47 +0200 | [diff] [blame] | 24 | #include <stdbool.h> |
Harald Welte | afedeab | 2010-03-04 10:55:40 +0100 | [diff] [blame] | 25 | #include <arpa/inet.h> |
| 26 | |
Neels Hofmeyr | 2d521a0 | 2016-05-14 00:57:04 +0200 | [diff] [blame] | 27 | #include <openbsc/common_bsc.h> |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 28 | #include <openbsc/gsm_04_08.h> |
Holger Hans Peter Freyther | ca11443 | 2014-02-08 15:20:48 +0100 | [diff] [blame] | 29 | #include <openbsc/gsm_04_11.h> |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 30 | #include <openbsc/gsm_subscriber.h> |
Max | 845a3a4 | 2017-05-15 12:02:29 +0200 | [diff] [blame] | 31 | #include <openbsc/gsm_data_shared.h> |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 32 | #include <openbsc/debug.h> |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 33 | #include <openbsc/arfcn_range_encode.h> |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 34 | #include <openbsc/system_information.h> |
| 35 | #include <openbsc/abis_rsl.h> |
| 36 | |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 37 | #include <osmocom/core/application.h> |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 38 | #include <osmocom/gsm/sysinfo.h> |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 39 | |
| 40 | #define COMPARE(result, op, value) \ |
| 41 | if (!((result) op (value))) {\ |
| 42 | fprintf(stderr, "Compare failed. Was %x should be %x in %s:%d\n",result, value, __FILE__, __LINE__); \ |
| 43 | exit(-1); \ |
| 44 | } |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 45 | |
| 46 | #define COMPARE_STR(result, value) \ |
| 47 | if (strcmp(result, value) != 0) { \ |
| 48 | fprintf(stderr, "Compare failed. Was %s should be %s in %s:%d\n",result, value, __FILE__, __LINE__); \ |
| 49 | exit(-1); \ |
| 50 | } |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 51 | |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 52 | #define DBG(...) |
| 53 | |
| 54 | #define VERIFY(res, cmp, wanted) \ |
| 55 | if (!(res cmp wanted)) { \ |
| 56 | printf("ASSERT failed: %s:%d Wanted: %d %s %d\n", \ |
Holger Hans Peter Freyther | daaea0c | 2015-08-03 09:28:41 +0200 | [diff] [blame] | 57 | __FILE__, __LINE__, (int) res, # cmp, (int) wanted); \ |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | |
| 61 | |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 62 | /* |
| 63 | * Test Location Area Identifier formatting. Table 10.5.3 of 04.08 |
| 64 | */ |
| 65 | static void test_location_area_identifier(void) |
| 66 | { |
| 67 | struct gsm48_loc_area_id lai48; |
| 68 | |
| 69 | printf("Testing test location area identifier\n"); |
| 70 | |
| 71 | /* |
| 72 | * Test the default/test setup. Coming from |
| 73 | * bsc_hack.c dumps |
| 74 | */ |
Harald Welte | afedeab | 2010-03-04 10:55:40 +0100 | [diff] [blame] | 75 | gsm48_generate_lai(&lai48, 1, 1, 1); |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 76 | COMPARE(lai48.digits[0], ==, 0x00); |
| 77 | COMPARE(lai48.digits[1], ==, 0xF1); |
| 78 | COMPARE(lai48.digits[2], ==, 0x10); |
| 79 | COMPARE(lai48.lac, ==, htons(0x0001)); |
| 80 | |
Harald Welte | afedeab | 2010-03-04 10:55:40 +0100 | [diff] [blame] | 81 | gsm48_generate_lai(&lai48, 602, 1, 15); |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 82 | COMPARE(lai48.digits[0], ==, 0x06); |
| 83 | COMPARE(lai48.digits[1], ==, 0xF2); |
| 84 | COMPARE(lai48.digits[2], ==, 0x10); |
| 85 | COMPARE(lai48.lac, ==, htons(0x000f)); |
| 86 | } |
| 87 | |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 88 | static inline void gen(struct gsm_bts *bts, const char *s) |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 89 | { |
Max | 845a3a4 | 2017-05-15 12:02:29 +0200 | [diff] [blame] | 90 | int r; |
| 91 | |
Max | 69e9c0d | 2016-05-18 13:04:47 +0200 | [diff] [blame] | 92 | bts->si_valid = 0; |
| 93 | bts->si_valid |= (1 << SYSINFO_TYPE_2quater); |
Max | 845a3a4 | 2017-05-15 12:02:29 +0200 | [diff] [blame] | 94 | |
Max | 845a3a4 | 2017-05-15 12:02:29 +0200 | [diff] [blame] | 95 | printf("generating SI2quater for %zu EARFCNs and %zu UARFCNs...\n", |
| 96 | si2q_earfcn_count(&bts->si_common.si2quater_neigh_list), bts->si_common.uarfcn_length); |
| 97 | |
| 98 | r = gsm_generate_si(bts, SYSINFO_TYPE_2quater); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 99 | if (r > 0) |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 100 | for (bts->si2q_index = 0; bts->si2q_index < bts->si2q_count + 1; bts->si2q_index++) |
| 101 | printf("generated %s SI2quater [%02u/%02u]: [%d] %s\n", |
| 102 | GSM_BTS_HAS_SI(bts, SYSINFO_TYPE_2quater) ? "valid" : "invalid", |
| 103 | bts->si2q_index, bts->si2q_count, r, |
| 104 | osmo_hexdump((void *)GSM_BTS_SI2Q(bts, bts->si2q_index), GSM_MACBLOCK_LEN)); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 105 | else |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 106 | printf("%s() failed to generate SI2quater: %s\n", s, strerror(-r)); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 107 | } |
| 108 | |
Max | 845a3a4 | 2017-05-15 12:02:29 +0200 | [diff] [blame] | 109 | static inline void del_earfcn_b(struct gsm_bts *bts, uint16_t earfcn) |
| 110 | { |
| 111 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
| 112 | int r = osmo_earfcn_del(e, earfcn); |
| 113 | if (r) |
| 114 | printf("failed to remove EARFCN %u: %s\n", earfcn, strerror(-r)); |
| 115 | else |
| 116 | printf("removed EARFCN %u - ", earfcn); |
| 117 | |
| 118 | gen(bts, __func__); |
| 119 | } |
| 120 | |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 121 | static inline void add_earfcn_b(struct gsm_bts *bts, uint16_t earfcn, uint8_t bw) |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 122 | { |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 123 | struct osmo_earfcn_si2q *e = &bts->si_common.si2quater_neigh_list; |
| 124 | int r = osmo_earfcn_add(e, earfcn, bw); |
| 125 | if (r) |
| 126 | printf("failed to add EARFCN %u: %s\n", earfcn, strerror(-r)); |
| 127 | else |
| 128 | printf("added EARFCN %u - ", earfcn); |
| 129 | |
| 130 | gen(bts, __func__); |
| 131 | } |
| 132 | |
| 133 | static inline void _bts_uarfcn_add(struct gsm_bts *bts, uint16_t arfcn, uint16_t scramble, bool diversity) |
| 134 | { |
| 135 | int r; |
| 136 | |
| 137 | bts->u_offset = 0; |
| 138 | |
| 139 | r = bts_uarfcn_add(bts, arfcn, scramble, diversity); |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 140 | if (r < 0) |
| 141 | printf("failed to add UARFCN to SI2quater: %s\n", strerror(-r)); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 142 | else { |
| 143 | bts->si2q_count = si2q_num(bts) - 1; |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 144 | gen(bts, __func__); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 145 | } |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 146 | } |
| 147 | |
Max | 881064e | 2016-12-14 14:51:40 +0100 | [diff] [blame] | 148 | static inline void test_si2q_segfault(void) |
| 149 | { |
| 150 | struct gsm_bts *bts; |
| 151 | struct gsm_network *network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); |
| 152 | printf("Test SI2quater UARFCN (same scrambling code and diversity):\n"); |
| 153 | |
| 154 | if (!network) |
| 155 | exit(1); |
| 156 | bts = gsm_bts_alloc(network); |
| 157 | |
| 158 | _bts_uarfcn_add(bts, 10564, 319, 0); |
| 159 | _bts_uarfcn_add(bts, 10612, 319, 0); |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 160 | gen(bts, __func__); |
Max | 881064e | 2016-12-14 14:51:40 +0100 | [diff] [blame] | 161 | } |
| 162 | |
Max | e610e70 | 2016-12-19 13:41:48 +0100 | [diff] [blame] | 163 | static inline void test_si2q_mu(void) |
| 164 | { |
| 165 | struct gsm_bts *bts; |
| 166 | struct gsm_network *network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); |
| 167 | printf("Test SI2quater multiple UARFCNs:\n"); |
| 168 | |
| 169 | if (!network) |
| 170 | exit(1); |
| 171 | bts = gsm_bts_alloc(network); |
| 172 | |
| 173 | _bts_uarfcn_add(bts, 10564, 318, 0); |
| 174 | _bts_uarfcn_add(bts, 10612, 319, 0); |
| 175 | _bts_uarfcn_add(bts, 10612, 31, 0); |
| 176 | _bts_uarfcn_add(bts, 10612, 19, 0); |
| 177 | _bts_uarfcn_add(bts, 10613, 64, 0); |
| 178 | _bts_uarfcn_add(bts, 10613, 164, 0); |
| 179 | _bts_uarfcn_add(bts, 10613, 14, 0); |
Max | e610e70 | 2016-12-19 13:41:48 +0100 | [diff] [blame] | 180 | } |
| 181 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 182 | static inline void test_si2q_u(void) |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 183 | { |
| 184 | struct gsm_bts *bts; |
Neels Hofmeyr | ce67be1 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 185 | struct gsm_network *network = bsc_network_init(NULL, 1, 1, NULL); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 186 | printf("Testing SYSINFO_TYPE_2quater UARFCN generation:\n"); |
| 187 | |
| 188 | if (!network) |
| 189 | exit(1); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 190 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 191 | bts = gsm_bts_alloc(network); |
| 192 | |
Max | 69e9c0d | 2016-05-18 13:04:47 +0200 | [diff] [blame] | 193 | /* first generate invalid SI as no UARFCN added */ |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 194 | gen(bts, __func__); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 195 | |
Max | 69e9c0d | 2016-05-18 13:04:47 +0200 | [diff] [blame] | 196 | /* subsequent calls should produce valid SI if there's enough memory */ |
Max | aafff96 | 2016-04-20 15:57:14 +0200 | [diff] [blame] | 197 | _bts_uarfcn_add(bts, 1982, 13, 1); |
| 198 | _bts_uarfcn_add(bts, 1982, 44, 0); |
| 199 | _bts_uarfcn_add(bts, 1982, 61, 1); |
| 200 | _bts_uarfcn_add(bts, 1982, 89, 1); |
| 201 | _bts_uarfcn_add(bts, 1982, 113, 0); |
| 202 | _bts_uarfcn_add(bts, 1982, 123, 0); |
| 203 | _bts_uarfcn_add(bts, 1982, 56, 1); |
| 204 | _bts_uarfcn_add(bts, 1982, 72, 1); |
| 205 | _bts_uarfcn_add(bts, 1982, 223, 1); |
| 206 | _bts_uarfcn_add(bts, 1982, 14, 0); |
| 207 | _bts_uarfcn_add(bts, 1982, 88, 0); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | static inline void test_si2q_e(void) |
| 211 | { |
| 212 | struct gsm_bts *bts; |
Neels Hofmeyr | ce67be1 | 2017-05-08 15:12:20 +0200 | [diff] [blame] | 213 | struct gsm_network *network = bsc_network_init(NULL, 1, 1, NULL); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 214 | printf("Testing SYSINFO_TYPE_2quater EARFCN generation:\n"); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 215 | |
| 216 | if (!network) |
| 217 | exit(1); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 218 | |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 219 | bts = gsm_bts_alloc(network); |
| 220 | |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 221 | bts->si_common.si2quater_neigh_list.arfcn = bts->si_common.data.earfcn_list; |
| 222 | bts->si_common.si2quater_neigh_list.meas_bw = bts->si_common.data.meas_bw_list; |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 223 | bts->si_common.si2quater_neigh_list.length = MAX_EARFCN_LIST; |
| 224 | bts->si_common.si2quater_neigh_list.thresh_hi = 5; |
| 225 | |
| 226 | osmo_earfcn_init(&bts->si_common.si2quater_neigh_list); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 227 | |
Max | 69e9c0d | 2016-05-18 13:04:47 +0200 | [diff] [blame] | 228 | /* first generate invalid SI as no EARFCN added */ |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 229 | gen(bts, __func__); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 230 | |
Max | 845a3a4 | 2017-05-15 12:02:29 +0200 | [diff] [blame] | 231 | /* subsequent calls should produce valid SI if there's enough memory and EARFCNs */ |
| 232 | add_earfcn_b(bts, 1917, 5); |
| 233 | del_earfcn_b(bts, 1917); |
Max | f39d03a | 2017-05-12 17:00:30 +0200 | [diff] [blame] | 234 | add_earfcn_b(bts, 1917, 1); |
| 235 | add_earfcn_b(bts, 1932, OSMO_EARFCN_MEAS_INVALID); |
| 236 | add_earfcn_b(bts, 1937, 2); |
| 237 | add_earfcn_b(bts, 1945, OSMO_EARFCN_MEAS_INVALID); |
| 238 | add_earfcn_b(bts, 1965, OSMO_EARFCN_MEAS_INVALID); |
| 239 | add_earfcn_b(bts, 1967, 4); |
| 240 | add_earfcn_b(bts, 1982, 3); |
Max | 59a1bf3 | 2016-04-15 16:04:46 +0200 | [diff] [blame] | 241 | } |
| 242 | |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 243 | static inline void test_si2q_long(void) |
| 244 | { |
| 245 | struct gsm_bts *bts; |
| 246 | struct gsm_network *network = bsc_network_init(tall_bsc_ctx, 1, 1, NULL); |
| 247 | printf("Testing SYSINFO_TYPE_2quater combined EARFCN & UARFCN generation:\n"); |
| 248 | |
| 249 | if (!network) |
| 250 | exit(1); |
| 251 | |
| 252 | bts = gsm_bts_alloc(network); |
| 253 | |
| 254 | bts->si_common.si2quater_neigh_list.arfcn = bts->si_common.data.earfcn_list; |
| 255 | bts->si_common.si2quater_neigh_list.meas_bw = bts->si_common.data.meas_bw_list; |
| 256 | bts->si_common.si2quater_neigh_list.length = MAX_EARFCN_LIST; |
| 257 | bts->si_common.si2quater_neigh_list.thresh_hi = 5; |
| 258 | |
| 259 | osmo_earfcn_init(&bts->si_common.si2quater_neigh_list); |
| 260 | |
| 261 | bts_earfcn_add(bts, 1922, 11, 22, 8,32, 8); |
| 262 | bts_earfcn_add(bts, 1922, 11, 22, 8, 32, 8); |
| 263 | bts_earfcn_add(bts, 1924, 11, 12, 6, 11, 5); |
| 264 | bts_earfcn_add(bts, 1923, 11, 12, 6, 11, 5); |
| 265 | bts_earfcn_add(bts, 1925, 11, 12, 6, 11, 5); |
| 266 | bts_earfcn_add(bts, 2111, 11, 12, 6, 11, 5); |
| 267 | bts_earfcn_add(bts, 2112, 11, 12, 6, 11, 4); |
| 268 | bts_earfcn_add(bts, 2113, 11, 12, 6, 11, 3); |
| 269 | bts_earfcn_add(bts, 2114, 11, 12, 6, 11, 2); |
| 270 | bts_earfcn_add(bts, 2131, 11, 12, 6, 11, 5); |
| 271 | bts_earfcn_add(bts, 2132, 11, 12, 6, 11, 4); |
| 272 | bts_earfcn_add(bts, 2133, 11, 12, 6, 11, 3); |
| 273 | bts_earfcn_add(bts, 2134, 11, 12, 6, 11, 2); |
| 274 | bts_earfcn_add(bts, 2121, 11, 12, 6, 11, 5); |
| 275 | bts_earfcn_add(bts, 2122, 11, 12, 6, 11, 4); |
| 276 | bts_earfcn_add(bts, 2123, 11, 12, 6, 11, 3); |
| 277 | bts_earfcn_add(bts, 2124, 11, 12, 6, 11, 2); |
| 278 | _bts_uarfcn_add(bts, 1976, 13, 1); |
| 279 | _bts_uarfcn_add(bts, 1976, 38, 1); |
| 280 | _bts_uarfcn_add(bts, 1976, 44, 1); |
| 281 | _bts_uarfcn_add(bts, 1976, 120, 1); |
| 282 | _bts_uarfcn_add(bts, 1976, 140, 1); |
| 283 | _bts_uarfcn_add(bts, 1976, 163, 1); |
| 284 | _bts_uarfcn_add(bts, 1976, 166, 1); |
| 285 | _bts_uarfcn_add(bts, 1976, 217, 1); |
| 286 | _bts_uarfcn_add(bts, 1976, 224, 1); |
| 287 | _bts_uarfcn_add(bts, 1976, 225, 1); |
| 288 | _bts_uarfcn_add(bts, 1976, 226, 1); |
| 289 | } |
| 290 | |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 291 | static void test_mi_functionality(void) |
| 292 | { |
| 293 | const char *imsi_odd = "987654321098763"; |
| 294 | const char *imsi_even = "9876543210987654"; |
Holger Hans Peter Freyther | c42ad8b | 2011-04-18 17:04:00 +0200 | [diff] [blame] | 295 | const uint32_t tmsi = 0xfabeacd0; |
| 296 | uint8_t mi[128]; |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 297 | unsigned int mi_len; |
| 298 | char mi_parsed[GSM48_MI_SIZE]; |
| 299 | |
| 300 | printf("Testing parsing and generating TMSI/IMSI\n"); |
| 301 | |
| 302 | /* tmsi code */ |
| 303 | mi_len = gsm48_generate_mid_from_tmsi(mi, tmsi); |
| 304 | gsm48_mi_to_string(mi_parsed, sizeof(mi_parsed), mi + 2, mi_len - 2); |
Harald Welte | 3ad0346 | 2016-03-17 14:41:26 +0100 | [diff] [blame] | 305 | COMPARE((uint32_t)strtoul(mi_parsed, NULL, 10), ==, tmsi); |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 306 | |
| 307 | /* imsi code */ |
| 308 | mi_len = gsm48_generate_mid_from_imsi(mi, imsi_odd); |
| 309 | gsm48_mi_to_string(mi_parsed, sizeof(mi_parsed), mi + 2, mi_len -2); |
Pablo Neira Ayuso | c0d17f2 | 2011-05-07 12:12:48 +0200 | [diff] [blame] | 310 | printf("hex: %s\n", osmo_hexdump(mi, mi_len)); |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 311 | COMPARE_STR(mi_parsed, imsi_odd); |
| 312 | |
| 313 | mi_len = gsm48_generate_mid_from_imsi(mi, imsi_even); |
| 314 | gsm48_mi_to_string(mi_parsed, sizeof(mi_parsed), mi + 2, mi_len -2); |
Pablo Neira Ayuso | c0d17f2 | 2011-05-07 12:12:48 +0200 | [diff] [blame] | 315 | printf("hex: %s\n", osmo_hexdump(mi, mi_len)); |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 316 | COMPARE_STR(mi_parsed, imsi_even); |
| 317 | } |
| 318 | |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 319 | struct { |
| 320 | int range; |
| 321 | int arfcns_num; |
| 322 | int arfcns[RANGE_ENC_MAX_ARFCNS]; |
| 323 | } arfcn_test_ranges[] = { |
| 324 | {ARFCN_RANGE_512, 12, |
| 325 | { 1, 12, 31, 51, 57, 91, 97, 98, 113, 117, 120, 125 }}, |
| 326 | {ARFCN_RANGE_512, 17, |
| 327 | { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }}, |
| 328 | {ARFCN_RANGE_512, 18, |
| 329 | { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }}, |
| 330 | {ARFCN_RANGE_512, 18, |
| 331 | { 1, 17, 31, 45, 58, 79, 81, 97, |
| 332 | 113, 127, 213, 277, 287, 311, 331, 391, |
| 333 | 417, 511 }}, |
| 334 | {ARFCN_RANGE_512, 6, |
| 335 | { 1, 17, 31, 45, 58, 79 }}, |
| 336 | {ARFCN_RANGE_512, 6, |
| 337 | { 10, 17, 31, 45, 58, 79 }}, |
| 338 | {ARFCN_RANGE_1024, 17, |
| 339 | { 0, 17, 31, 45, 58, 79, 81, 97, |
| 340 | 113, 127, 213, 277, 287, 311, 331, 391, |
| 341 | 1023 }}, |
| 342 | {ARFCN_RANGE_1024, 16, |
| 343 | { 17, 31, 45, 58, 79, 81, 97, 113, |
| 344 | 127, 213, 277, 287, 311, 331, 391, 1023 }}, |
| 345 | {-1} |
| 346 | }; |
| 347 | |
| 348 | static int test_single_range_encoding(int range, const int *orig_arfcns, |
| 349 | int arfcns_num, int silent) |
| 350 | { |
| 351 | int arfcns[RANGE_ENC_MAX_ARFCNS]; |
| 352 | int w[RANGE_ENC_MAX_ARFCNS]; |
| 353 | int f0_included = 0; |
| 354 | int rc, f0; |
| 355 | uint8_t chan_list[16] = {0}; |
| 356 | struct gsm_sysinfo_freq dec_freq[1024] = {{0}}; |
| 357 | int dec_arfcns[RANGE_ENC_MAX_ARFCNS] = {0}; |
| 358 | int dec_arfcns_count = 0; |
| 359 | int arfcns_used = 0; |
| 360 | int i; |
| 361 | |
| 362 | arfcns_used = arfcns_num; |
| 363 | memmove(arfcns, orig_arfcns, sizeof(arfcns)); |
| 364 | |
Jacob Erlbeck | 45014a0 | 2014-01-14 10:42:58 +0100 | [diff] [blame] | 365 | f0 = range == ARFCN_RANGE_1024 ? 0 : arfcns[0]; |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 366 | /* |
| 367 | * Manipulate the ARFCN list according to the rules in J4 depending |
| 368 | * on the selected range. |
| 369 | */ |
Jacob Erlbeck | 45014a0 | 2014-01-14 10:42:58 +0100 | [diff] [blame] | 370 | arfcns_used = range_enc_filter_arfcns(arfcns, arfcns_used, |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 371 | f0, &f0_included); |
| 372 | |
| 373 | memset(w, 0, sizeof(w)); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 374 | range_enc_arfcns(range, arfcns, arfcns_used, w, 0); |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 375 | |
| 376 | if (!silent) |
| 377 | fprintf(stderr, "range=%d, arfcns_used=%d, f0=%d, f0_included=%d\n", |
| 378 | range, arfcns_used, f0, f0_included); |
| 379 | |
| 380 | /* Select the range and the amount of bits needed */ |
| 381 | switch (range) { |
| 382 | case ARFCN_RANGE_128: |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 383 | range_enc_range128(chan_list, f0, w); |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 384 | break; |
| 385 | case ARFCN_RANGE_256: |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 386 | range_enc_range256(chan_list, f0, w); |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 387 | break; |
| 388 | case ARFCN_RANGE_512: |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 389 | range_enc_range512(chan_list, f0, w); |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 390 | break; |
| 391 | case ARFCN_RANGE_1024: |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 392 | range_enc_range1024(chan_list, f0, f0_included, w); |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 393 | break; |
| 394 | default: |
| 395 | return 1; |
| 396 | }; |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 397 | |
| 398 | if (!silent) |
| 399 | printf("chan_list = %s\n", |
| 400 | osmo_hexdump(chan_list, sizeof(chan_list))); |
| 401 | |
| 402 | rc = gsm48_decode_freq_list(dec_freq, chan_list, sizeof(chan_list), |
| 403 | 0xfe, 1); |
| 404 | if (rc != 0) { |
| 405 | printf("Cannot decode freq list, rc = %d\n", rc); |
| 406 | return 1; |
| 407 | } |
| 408 | |
| 409 | for (i = 0; i < ARRAY_SIZE(dec_freq); i++) { |
| 410 | if (dec_freq[i].mask && |
| 411 | dec_arfcns_count < ARRAY_SIZE(dec_arfcns)) |
| 412 | dec_arfcns[dec_arfcns_count++] = i; |
| 413 | } |
| 414 | |
| 415 | if (!silent) { |
| 416 | printf("Decoded freqs %d (expected %d)\n", |
| 417 | dec_arfcns_count, arfcns_num); |
| 418 | printf("Decoded: "); |
| 419 | for (i = 0; i < dec_arfcns_count; i++) { |
| 420 | printf("%d ", dec_arfcns[i]); |
| 421 | if (dec_arfcns[i] != orig_arfcns[i]) |
| 422 | printf("(!= %d) ", orig_arfcns[i]); |
| 423 | } |
| 424 | printf("\n"); |
| 425 | } |
| 426 | |
| 427 | if (dec_arfcns_count != arfcns_num) { |
| 428 | printf("Wrong number of arfcns\n"); |
| 429 | return 1; |
| 430 | } |
| 431 | |
| 432 | if (memcmp(dec_arfcns, orig_arfcns, sizeof(dec_arfcns)) != 0) { |
| 433 | printf("Decoding error, got wrong freqs\n"); |
| 434 | fprintf(stderr, " w = "); |
| 435 | for (i = 0; i < ARRAY_SIZE(w); i++) |
| 436 | fprintf(stderr, "%d ", w[i]); |
| 437 | fprintf(stderr, "\n"); |
| 438 | return 1; |
| 439 | } |
| 440 | |
| 441 | return 0; |
| 442 | } |
| 443 | |
| 444 | static void test_random_range_encoding(int range, int max_arfcn_num) |
| 445 | { |
| 446 | int arfcns_num = 0; |
| 447 | int test_idx; |
| 448 | int rc, max_count; |
| 449 | int num_tests = 1024; |
| 450 | |
| 451 | printf("Random range test: range %d, max num ARFCNs %d\n", |
| 452 | range, max_arfcn_num); |
| 453 | |
| 454 | srandom(1); |
| 455 | |
| 456 | for (max_count = 1; max_count < max_arfcn_num; max_count++) { |
| 457 | for (test_idx = 0; test_idx < num_tests; test_idx++) { |
| 458 | int count; |
| 459 | int i; |
| 460 | int min_freq = 0; |
| 461 | |
| 462 | int rnd_arfcns[RANGE_ENC_MAX_ARFCNS] = {0}; |
| 463 | char rnd_arfcns_set[1024] = {0}; |
| 464 | |
| 465 | if (range < ARFCN_RANGE_1024) |
| 466 | min_freq = random() % (1023 - range); |
| 467 | |
| 468 | for (count = max_count; count; ) { |
| 469 | int arfcn = min_freq + random() % (range + 1); |
| 470 | OSMO_ASSERT(arfcn < ARRAY_SIZE(rnd_arfcns_set)); |
| 471 | |
| 472 | if (!rnd_arfcns_set[arfcn]) { |
| 473 | rnd_arfcns_set[arfcn] = 1; |
| 474 | count -= 1; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | arfcns_num = 0; |
| 479 | for (i = 0; i < ARRAY_SIZE(rnd_arfcns_set); i++) |
| 480 | if (rnd_arfcns_set[i]) |
| 481 | rnd_arfcns[arfcns_num++] = i; |
| 482 | |
| 483 | rc = test_single_range_encoding(range, rnd_arfcns, |
| 484 | arfcns_num, 1); |
| 485 | if (rc != 0) { |
| 486 | printf("Failed on test %d, range %d, num ARFCNs %d\n", |
| 487 | test_idx, range, max_count); |
| 488 | test_single_range_encoding(range, rnd_arfcns, |
| 489 | arfcns_num, 0); |
| 490 | return; |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | static void test_range_encoding() |
| 497 | { |
| 498 | int *arfcns; |
| 499 | int arfcns_num = 0; |
| 500 | int test_idx; |
| 501 | int range; |
| 502 | |
| 503 | for (test_idx = 0; arfcn_test_ranges[test_idx].arfcns_num > 0; test_idx++) |
| 504 | { |
| 505 | arfcns_num = arfcn_test_ranges[test_idx].arfcns_num; |
| 506 | arfcns = &arfcn_test_ranges[test_idx].arfcns[0]; |
| 507 | range = arfcn_test_ranges[test_idx].range; |
| 508 | |
| 509 | printf("Range test %d: range %d, num ARFCNs %d\n", |
| 510 | test_idx, range, arfcns_num); |
| 511 | |
| 512 | test_single_range_encoding(range, arfcns, arfcns_num, 0); |
| 513 | } |
| 514 | |
| 515 | test_random_range_encoding(ARFCN_RANGE_128, 29); |
| 516 | test_random_range_encoding(ARFCN_RANGE_256, 22); |
| 517 | test_random_range_encoding(ARFCN_RANGE_512, 18); |
| 518 | test_random_range_encoding(ARFCN_RANGE_1024, 16); |
| 519 | } |
| 520 | |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 521 | static int freqs1[] = { |
| 522 | 12, 70, 121, 190, 250, 320, 401, 475, 520, 574, 634, 700, 764, 830, 905, 980 |
| 523 | }; |
| 524 | |
| 525 | static int freqs2[] = { |
| 526 | 402, 460, 1, 67, 131, 197, 272, 347, |
| 527 | }; |
| 528 | |
| 529 | static int freqs3[] = { |
| 530 | 68, 128, 198, 279, 353, 398, 452, |
| 531 | |
| 532 | }; |
| 533 | |
| 534 | static int w_out[] = { |
| 535 | 122, 2, 69, 204, 75, 66, 60, 70, 83, 3, 24, 67, 54, 64, 70, 9, |
| 536 | }; |
| 537 | |
| 538 | static int range128[] = { |
| 539 | 1, 1 + 127, |
| 540 | }; |
| 541 | |
| 542 | static int range256[] = { |
| 543 | 1, 1 + 128, |
| 544 | }; |
| 545 | |
| 546 | static int range512[] = { |
| 547 | 1, 1+ 511, |
| 548 | }; |
| 549 | |
| 550 | |
| 551 | static void test_arfcn_filter() |
| 552 | { |
| 553 | int arfcns[50], i, res, f0_included; |
| 554 | for (i = 0; i < ARRAY_SIZE(arfcns); ++i) |
| 555 | arfcns[i] = (i + 1) * 2; |
| 556 | |
| 557 | /* check that the arfcn is taken out. f0_included is only set for Range1024 */ |
| 558 | f0_included = 24; |
Jacob Erlbeck | 45014a0 | 2014-01-14 10:42:58 +0100 | [diff] [blame] | 559 | res = range_enc_filter_arfcns(arfcns, ARRAY_SIZE(arfcns), |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 560 | arfcns[0], &f0_included); |
| 561 | VERIFY(res, ==, ARRAY_SIZE(arfcns) - 1); |
| 562 | VERIFY(f0_included, ==, 1); |
| 563 | for (i = 0; i < res; ++i) |
Jacob Erlbeck | 45014a0 | 2014-01-14 10:42:58 +0100 | [diff] [blame] | 564 | VERIFY(arfcns[i], ==, ((i+2) * 2) - (2+1)); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 565 | |
Jacob Erlbeck | 45014a0 | 2014-01-14 10:42:58 +0100 | [diff] [blame] | 566 | /* check with range1024, ARFCN 0 is included */ |
| 567 | for (i = 0; i < ARRAY_SIZE(arfcns); ++i) |
| 568 | arfcns[i] = i * 2; |
| 569 | res = range_enc_filter_arfcns(arfcns, ARRAY_SIZE(arfcns), |
| 570 | 0, &f0_included); |
| 571 | VERIFY(res, ==, ARRAY_SIZE(arfcns) - 1); |
| 572 | VERIFY(f0_included, ==, 1); |
| 573 | for (i = 0; i < res; ++i) |
| 574 | VERIFY(arfcns[i], ==, (i + 1) * 2 - 1); |
| 575 | |
| 576 | /* check with range1024, ARFCN 0 not included */ |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 577 | for (i = 0; i < ARRAY_SIZE(arfcns); ++i) |
| 578 | arfcns[i] = (i + 1) * 2; |
Jacob Erlbeck | 45014a0 | 2014-01-14 10:42:58 +0100 | [diff] [blame] | 579 | res = range_enc_filter_arfcns(arfcns, ARRAY_SIZE(arfcns), |
| 580 | 0, &f0_included); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 581 | VERIFY(res, ==, ARRAY_SIZE(arfcns)); |
| 582 | VERIFY(f0_included, ==, 0); |
| 583 | for (i = 0; i < res; ++i) |
| 584 | VERIFY(arfcns[i], ==, ((i + 1) * 2) - 1); |
| 585 | } |
| 586 | |
| 587 | static void test_print_encoding() |
| 588 | { |
| 589 | int rc; |
| 590 | int w[17]; |
| 591 | uint8_t chan_list[16]; |
| 592 | memset(chan_list, 0x23, sizeof(chan_list)); |
| 593 | |
| 594 | for (rc = 0; rc < ARRAY_SIZE(w); ++rc) |
| 595 | switch (rc % 3) { |
| 596 | case 0: |
| 597 | w[rc] = 0xAAAA; |
| 598 | break; |
| 599 | case 1: |
| 600 | w[rc] = 0x5555; |
| 601 | break; |
| 602 | case 2: |
| 603 | w[rc] = 0x9696; |
| 604 | break; |
| 605 | } |
| 606 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 607 | range_enc_range512(chan_list, (1 << 9) | 0x96, w); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 608 | |
| 609 | printf("Range512: %s\n", osmo_hexdump(chan_list, ARRAY_SIZE(chan_list))); |
| 610 | } |
| 611 | |
| 612 | static void test_si_range_helpers() |
| 613 | { |
| 614 | int ws[(sizeof(freqs1)/sizeof(freqs1[0]))]; |
| 615 | int i, f0 = 0xFFFFFF; |
| 616 | |
| 617 | memset(&ws[0], 0x23, sizeof(ws)); |
| 618 | |
| 619 | i = range_enc_find_index(1023, freqs1, ARRAY_SIZE(freqs1)); |
Jacob Erlbeck | 1dc022c | 2014-01-17 09:22:57 +0100 | [diff] [blame] | 620 | printf("Element is: %d => freqs[i] = %d\n", i, i >= 0 ? freqs1[i] : -1); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 621 | VERIFY(i, ==, 2); |
| 622 | |
| 623 | i = range_enc_find_index(511, freqs2, ARRAY_SIZE(freqs2)); |
Jacob Erlbeck | 1dc022c | 2014-01-17 09:22:57 +0100 | [diff] [blame] | 624 | printf("Element is: %d => freqs[i] = %d\n", i, i >= 0 ? freqs2[i] : -1); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 625 | VERIFY(i, ==, 2); |
| 626 | |
| 627 | i = range_enc_find_index(511, freqs3, ARRAY_SIZE(freqs3)); |
Jacob Erlbeck | 1dc022c | 2014-01-17 09:22:57 +0100 | [diff] [blame] | 628 | printf("Element is: %d => freqs[i] = %d\n", i, i >= 0 ? freqs3[i] : -1); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 629 | VERIFY(i, ==, 0); |
| 630 | |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 631 | range_enc_arfcns(1023, freqs1, ARRAY_SIZE(freqs1), ws, 0); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 632 | |
| 633 | for (i = 0; i < sizeof(freqs1)/sizeof(freqs1[0]); ++i) { |
| 634 | printf("w[%d]=%d\n", i, ws[i]); |
| 635 | VERIFY(ws[i], ==, w_out[i]); |
| 636 | } |
| 637 | |
| 638 | i = range_enc_determine_range(range128, ARRAY_SIZE(range128), &f0); |
| 639 | VERIFY(i, ==, ARFCN_RANGE_128); |
| 640 | VERIFY(f0, ==, 1); |
| 641 | |
| 642 | i = range_enc_determine_range(range256, ARRAY_SIZE(range256), &f0); |
| 643 | VERIFY(i, ==, ARFCN_RANGE_256); |
| 644 | VERIFY(f0, ==, 1); |
| 645 | |
| 646 | i = range_enc_determine_range(range512, ARRAY_SIZE(range512), &f0); |
| 647 | VERIFY(i, ==, ARFCN_RANGE_512); |
| 648 | VERIFY(f0, ==, 1); |
| 649 | } |
| 650 | |
Holger Hans Peter Freyther | ca11443 | 2014-02-08 15:20:48 +0100 | [diff] [blame] | 651 | static void test_gsm411_rp_ref_wrap(void) |
| 652 | { |
| 653 | struct gsm_subscriber_connection conn; |
| 654 | int res; |
| 655 | |
| 656 | printf("testing RP-Reference wrap\n"); |
| 657 | |
| 658 | memset(&conn, 0, sizeof(conn)); |
| 659 | conn.next_rp_ref = 255; |
| 660 | |
Neels Hofmeyr | 05667a0 | 2016-05-10 13:27:32 +0200 | [diff] [blame] | 661 | res = sms_next_rp_msg_ref(&conn.next_rp_ref); |
Holger Hans Peter Freyther | ca11443 | 2014-02-08 15:20:48 +0100 | [diff] [blame] | 662 | printf("Allocated reference: %d\n", res); |
| 663 | OSMO_ASSERT(res == 255); |
| 664 | |
Neels Hofmeyr | 05667a0 | 2016-05-10 13:27:32 +0200 | [diff] [blame] | 665 | res = sms_next_rp_msg_ref(&conn.next_rp_ref); |
Holger Hans Peter Freyther | ca11443 | 2014-02-08 15:20:48 +0100 | [diff] [blame] | 666 | printf("Allocated reference: %d\n", res); |
| 667 | OSMO_ASSERT(res == 0); |
| 668 | |
Neels Hofmeyr | 05667a0 | 2016-05-10 13:27:32 +0200 | [diff] [blame] | 669 | res = sms_next_rp_msg_ref(&conn.next_rp_ref); |
Holger Hans Peter Freyther | ca11443 | 2014-02-08 15:20:48 +0100 | [diff] [blame] | 670 | printf("Allocated reference: %d\n", res); |
| 671 | OSMO_ASSERT(res == 1); |
| 672 | } |
| 673 | |
Holger Hans Peter Freyther | adb6e1c | 2010-09-18 06:44:24 +0800 | [diff] [blame] | 674 | int main(int argc, char **argv) |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 675 | { |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 676 | osmo_init_logging(&log_info); |
| 677 | log_set_log_level(osmo_stderr_target, LOGL_INFO); |
| 678 | |
Holger Hans Peter Freyther | 5d0e56f | 2009-08-20 08:41:24 +0200 | [diff] [blame] | 679 | test_location_area_identifier(); |
| 680 | test_mi_functionality(); |
Jacob Erlbeck | 9444d4f | 2014-01-13 14:43:40 +0100 | [diff] [blame] | 681 | |
| 682 | test_si_range_helpers(); |
| 683 | test_arfcn_filter(); |
| 684 | test_print_encoding(); |
Jacob Erlbeck | 4b903b4 | 2014-01-10 17:43:41 +0100 | [diff] [blame] | 685 | test_range_encoding(); |
Holger Hans Peter Freyther | ca11443 | 2014-02-08 15:20:48 +0100 | [diff] [blame] | 686 | test_gsm411_rp_ref_wrap(); |
Harald Welte | afedeab | 2010-03-04 10:55:40 +0100 | [diff] [blame] | 687 | |
Max | 881064e | 2016-12-14 14:51:40 +0100 | [diff] [blame] | 688 | test_si2q_segfault(); |
Max | 26679e0 | 2016-04-20 15:57:13 +0200 | [diff] [blame] | 689 | test_si2q_e(); |
| 690 | test_si2q_u(); |
Max | e610e70 | 2016-12-19 13:41:48 +0100 | [diff] [blame] | 691 | test_si2q_mu(); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 692 | test_si2q_long(); |
| 693 | |
Holger Hans Peter Freyther | 300457b | 2012-01-06 15:03:28 +0100 | [diff] [blame] | 694 | printf("Done.\n"); |
Max | 70fdd24 | 2017-06-15 15:10:53 +0200 | [diff] [blame] | 695 | |
Holger Hans Peter Freyther | 300457b | 2012-01-06 15:03:28 +0100 | [diff] [blame] | 696 | return EXIT_SUCCESS; |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 697 | } |