aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Willmann <daniel@totalueberwachung.de>2013-12-28 13:59:24 +0100
committerDaniel Willmann <daniel@totalueberwachung.de>2014-01-15 15:23:21 +0100
commit7c3751b10bff1887e4981aa787c913aa4c812da2 (patch)
tree725302590546aa3ffb712200ef63863db3ecc209 /tests
parentf4a1ec6ce7bd38b829309fe7e04ef3d534d24581 (diff)
rlc/tbf: Move v_n into gprs_rlc_ul_window and adapt the tests
v_n is part of the UL window handling so move it inside the ul_window
Diffstat (limited to 'tests')
-rw-r--r--tests/types/TypesTest.cpp79
1 files changed, 39 insertions, 40 deletions
diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index ea9fdbe..1ea3229 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -193,24 +193,23 @@ static void test_rlc_dl_ul_basic()
{
gprs_rlc_ul_window ul_win = { 0, };
- gprs_rlc_v_n v_n;
int count;
const char *rbb;
char win_rbb[65];
uint8_t bin_rbb[8];
win_rbb[64] = '\0';
- v_n.reset();
+ ul_win.m_v_n.reset();
OSMO_ASSERT(ul_win.is_in_window(0));
OSMO_ASSERT(ul_win.is_in_window(63));
OSMO_ASSERT(!ul_win.is_in_window(64));
- OSMO_ASSERT(!v_n.is_received(0));
+ OSMO_ASSERT(!ul_win.m_v_n.is_received(0));
rbb = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII";
OSMO_ASSERT(ul_win.ssn() == 0);
- ul_win.update_rbb(&v_n, win_rbb);
+ ul_win.update_rbb(win_rbb);
OSMO_ASSERT_STR_EQ(win_rbb, rbb);
Encoding::encode_rbb(win_rbb, bin_rbb);
printf("rbb: %s\n", osmo_hexdump(bin_rbb, sizeof(bin_rbb)));
@@ -219,17 +218,17 @@ static void test_rlc_dl_ul_basic()
/* simulate to have received 0, 1 and 5 */
OSMO_ASSERT(ul_win.is_in_window(0));
- v_n.mark_received(0);
- ul_win.raise_v_r(0, &v_n);
- count = ul_win.raise_v_q(&v_n);
- OSMO_ASSERT(v_n.is_received(0));
+ ul_win.m_v_n.mark_received(0);
+ ul_win.raise_v_r(0);
+ count = ul_win.raise_v_q();
+ OSMO_ASSERT(ul_win.m_v_n.is_received(0));
OSMO_ASSERT(ul_win.v_q() == 1);
OSMO_ASSERT(ul_win.v_r() == 1);
OSMO_ASSERT(count == 1);
rbb = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIR";
OSMO_ASSERT(ul_win.ssn() == 1);
- ul_win.update_rbb(&v_n, win_rbb);
+ ul_win.update_rbb(win_rbb);
OSMO_ASSERT_STR_EQ(win_rbb, rbb);
Encoding::encode_rbb(win_rbb, bin_rbb);
printf("rbb: %s\n", osmo_hexdump(bin_rbb, sizeof(bin_rbb)));
@@ -237,17 +236,17 @@ static void test_rlc_dl_ul_basic()
OSMO_ASSERT_STR_EQ(win_rbb, rbb);
OSMO_ASSERT(ul_win.is_in_window(1));
- v_n.mark_received(1);
- ul_win.raise_v_r(1, &v_n);
- count = ul_win.raise_v_q(&v_n);
- OSMO_ASSERT(v_n.is_received(0));
+ ul_win.m_v_n.mark_received(1);
+ ul_win.raise_v_r(1);
+ count = ul_win.raise_v_q();
+ OSMO_ASSERT(ul_win.m_v_n.is_received(0));
OSMO_ASSERT(ul_win.v_q() == 2);
OSMO_ASSERT(ul_win.v_r() == 2);
OSMO_ASSERT(count == 1);
rbb = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIRR";
OSMO_ASSERT(ul_win.ssn() == 2);
- ul_win.update_rbb(&v_n, win_rbb);
+ ul_win.update_rbb(win_rbb);
OSMO_ASSERT_STR_EQ(win_rbb, rbb);
Encoding::encode_rbb(win_rbb, bin_rbb);
printf("rbb: %s\n", osmo_hexdump(bin_rbb, sizeof(bin_rbb)));
@@ -255,17 +254,17 @@ static void test_rlc_dl_ul_basic()
OSMO_ASSERT_STR_EQ(win_rbb, rbb);
OSMO_ASSERT(ul_win.is_in_window(5));
- v_n.mark_received(5);
- ul_win.raise_v_r(5, &v_n);
- count = ul_win.raise_v_q(&v_n);
- OSMO_ASSERT(v_n.is_received(0));
+ ul_win.m_v_n.mark_received(5);
+ ul_win.raise_v_r(5);
+ count = ul_win.raise_v_q();
+ OSMO_ASSERT(ul_win.m_v_n.is_received(0));
OSMO_ASSERT(ul_win.v_q() == 2);
OSMO_ASSERT(ul_win.v_r() == 6);
OSMO_ASSERT(count == 0);
rbb = "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIRRIIIR";
OSMO_ASSERT(ul_win.ssn() == 6);
- ul_win.update_rbb(&v_n, win_rbb);
+ ul_win.update_rbb(win_rbb);
OSMO_ASSERT_STR_EQ(win_rbb, rbb);
Encoding::encode_rbb(win_rbb, bin_rbb);
printf("rbb: %s\n", osmo_hexdump(bin_rbb, sizeof(bin_rbb)));
@@ -274,18 +273,18 @@ static void test_rlc_dl_ul_basic()
OSMO_ASSERT(ul_win.is_in_window(65));
OSMO_ASSERT(ul_win.is_in_window(2));
- OSMO_ASSERT(v_n.is_received(5));
- v_n.mark_received(65);
- ul_win.raise_v_r(65, &v_n);
- count = ul_win.raise_v_q(&v_n);
+ OSMO_ASSERT(ul_win.m_v_n.is_received(5));
+ ul_win.m_v_n.mark_received(65);
+ ul_win.raise_v_r(65);
+ count = ul_win.raise_v_q();
OSMO_ASSERT(count == 0);
- OSMO_ASSERT(v_n.is_received(5));
+ OSMO_ASSERT(ul_win.m_v_n.is_received(5));
OSMO_ASSERT(ul_win.v_q() == 2);
OSMO_ASSERT(ul_win.v_r() == 66);
rbb = "IIIRIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIR";
OSMO_ASSERT(ul_win.ssn() == 66);
- ul_win.update_rbb(&v_n, win_rbb);
+ ul_win.update_rbb(win_rbb);
OSMO_ASSERT_STR_EQ(win_rbb, rbb);
Encoding::encode_rbb(win_rbb, bin_rbb);
printf("rbb: %s\n", osmo_hexdump(bin_rbb, sizeof(bin_rbb)));
@@ -294,33 +293,33 @@ static void test_rlc_dl_ul_basic()
OSMO_ASSERT(ul_win.is_in_window(2));
OSMO_ASSERT(!ul_win.is_in_window(66));
- v_n.mark_received(2);
- ul_win.raise_v_r(2, &v_n);
- count = ul_win.raise_v_q(&v_n);
+ ul_win.m_v_n.mark_received(2);
+ ul_win.raise_v_r(2);
+ count = ul_win.raise_v_q();
OSMO_ASSERT(count == 1);
OSMO_ASSERT(ul_win.v_q() == 3);
OSMO_ASSERT(ul_win.v_r() == 66);
OSMO_ASSERT(ul_win.is_in_window(66));
- v_n.mark_received(66);
- ul_win.raise_v_r(66, &v_n);
- count = ul_win.raise_v_q(&v_n);
+ ul_win.m_v_n.mark_received(66);
+ ul_win.raise_v_r(66);
+ count = ul_win.raise_v_q();
OSMO_ASSERT(count == 0);
OSMO_ASSERT(ul_win.v_q() == 3);
OSMO_ASSERT(ul_win.v_r() == 67);
for (int i = 3; i <= 67; ++i) {
- v_n.mark_received(i);
- ul_win.raise_v_r(i, &v_n);
- ul_win.raise_v_q(&v_n);
+ ul_win.m_v_n.mark_received(i);
+ ul_win.raise_v_r(i);
+ ul_win.raise_v_q();
}
OSMO_ASSERT(ul_win.v_q() == 68);
OSMO_ASSERT(ul_win.v_r() == 68);
- v_n.mark_received(68);
- ul_win.raise_v_r(68, &v_n);
- count = ul_win.raise_v_q(&v_n);
+ ul_win.m_v_n.mark_received(68);
+ ul_win.raise_v_r(68);
+ count = ul_win.raise_v_q();
OSMO_ASSERT(ul_win.v_q() == 69);
OSMO_ASSERT(ul_win.v_r() == 69);
OSMO_ASSERT(count == 1);
@@ -328,9 +327,9 @@ static void test_rlc_dl_ul_basic()
/* now test the wrapping */
OSMO_ASSERT(ul_win.is_in_window(4));
OSMO_ASSERT(!ul_win.is_in_window(5));
- v_n.mark_received(4);
- ul_win.raise_v_r(4, &v_n);
- count = ul_win.raise_v_q(&v_n);
+ ul_win.m_v_n.mark_received(4);
+ ul_win.raise_v_r(4);
+ count = ul_win.raise_v_q();
OSMO_ASSERT(count == 0);
}