From 48df40d2a4ca216f08e8161701918fe5b7bf9edd Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Wed, 11 Dec 2013 16:51:26 +0100 Subject: tests/TypesTest: Check rbb handling in DL --- tests/types/TypesTest.cpp | 36 ++++++++++++++++++++++++++++++++++++ tests/types/TypesTest.ok | 1 + 2 files changed, 37 insertions(+) (limited to 'tests') diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp index 407f91e8..ea9fdbeb 100644 --- a/tests/types/TypesTest.cpp +++ b/tests/types/TypesTest.cpp @@ -333,6 +333,42 @@ static void test_rlc_dl_ul_basic() count = ul_win.raise_v_q(&v_n); OSMO_ASSERT(count == 0); } + + { + int count; + uint8_t rbb[8]; + uint16_t lost = 0, recv = 0; + char show_rbb[65]; + BTS dummy_bts; + gprs_rlc_dl_window dl_win = { 0, }; + gprs_rlc_v_b v_b; + + v_b.reset(); + + OSMO_ASSERT(dl_win.window_empty()); + OSMO_ASSERT(!dl_win.window_stalled()); + OSMO_ASSERT(dl_win.distance() == 0); + + dl_win.increment_send(); + OSMO_ASSERT(!dl_win.window_empty()); + OSMO_ASSERT(!dl_win.window_stalled()); + OSMO_ASSERT(dl_win.distance() == 1); + + for (int i = 0; i < 35; ++i) { + dl_win.increment_send(); + OSMO_ASSERT(!dl_win.window_empty()); + OSMO_ASSERT(dl_win.distance() == i + 2); + } + + uint8_t rbb_cmp[8] = { 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff }; + Decoding::extract_rbb(rbb_cmp, show_rbb); + printf("show_rbb: %s\n", show_rbb); + + v_b.update(&dummy_bts, show_rbb, 35, dl_win, &lost, &recv); + OSMO_ASSERT(lost == 0); + OSMO_ASSERT(recv == 35); + + } } int main(int argc, char **argv) diff --git a/tests/types/TypesTest.ok b/tests/types/TypesTest.ok index 4f5f15f6..6ca2717c 100644 --- a/tests/types/TypesTest.ok +++ b/tests/types/TypesTest.ok @@ -4,3 +4,4 @@ rbb: 00 00 00 00 00 00 00 01 rbb: 00 00 00 00 00 00 00 03 rbb: 00 00 00 00 00 00 00 31 rbb: 10 00 00 00 00 00 00 01 +show_rbb: IIIIIIIIIIIIIIIIIIIIIIIIIIIIIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR -- cgit v1.2.3