diff options
Diffstat (limited to 'openbsc/tests/gsm0408/gsm0408_test.c')
-rw-r--r-- | openbsc/tests/gsm0408/gsm0408_test.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 38c1a6a8c..692ec90b0 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -25,6 +25,7 @@ #include <arpa/inet.h> #include <openbsc/gsm_04_08.h> +#include <openbsc/gsm_04_11.h> #include <openbsc/gsm_subscriber.h> #include <openbsc/debug.h> #include <openbsc/arfcn_range_encode.h> @@ -448,6 +449,29 @@ static void test_si_range_helpers() VERIFY(f0, ==, 1); } +static void test_gsm411_rp_ref_wrap(void) +{ + struct gsm_subscriber_connection conn; + int res; + + printf("testing RP-Reference wrap\n"); + + memset(&conn, 0, sizeof(conn)); + conn.next_rp_ref = 255; + + res = sms_next_rp_msg_ref(&conn); + printf("Allocated reference: %d\n", res); + OSMO_ASSERT(res == 255); + + res = sms_next_rp_msg_ref(&conn); + printf("Allocated reference: %d\n", res); + OSMO_ASSERT(res == 0); + + res = sms_next_rp_msg_ref(&conn); + printf("Allocated reference: %d\n", res); + OSMO_ASSERT(res == 1); +} + int main(int argc, char **argv) { osmo_init_logging(&log_info); @@ -460,6 +484,7 @@ int main(int argc, char **argv) test_arfcn_filter(); test_print_encoding(); test_range_encoding(); + test_gsm411_rp_ref_wrap(); printf("Done.\n"); return EXIT_SUCCESS; |