aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-24 22:17:40 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-26 21:00:51 +0100
commitfaf3ef45b34f9ce94cbb123dfee1bfb7ac76c46f (patch)
treecb2a620d0c77f7384aa33e3ac21194630de76dbd
parente9b1ebba9d720374700d3cb2537fcd2725c50a84 (diff)
rlc: Add a basic test for the DL Window and moving the window
-rw-r--r--tests/types/TypesTest.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index 8f6aec2..28180f7 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -134,6 +134,54 @@ static void test_rlc_v_n()
}
}
+static void test_rlc_dl_ul_basic()
+{
+ {
+ gprs_rlc_dl_window dl_win = { 0, };
+ 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 = 1; i < 64; ++i) {
+ dl_win.increment_send();
+ OSMO_ASSERT(!dl_win.window_empty());
+ OSMO_ASSERT(dl_win.distance() == i + 1);
+ }
+
+ OSMO_ASSERT(dl_win.distance() == 64);
+ OSMO_ASSERT(dl_win.window_stalled());
+
+ dl_win.raise(1);
+ OSMO_ASSERT(dl_win.distance() == 63);
+ OSMO_ASSERT(!dl_win.window_stalled());
+ for (int i = 62; i >= 0; --i) {
+ dl_win.raise(1);
+ OSMO_ASSERT(dl_win.distance() == i);
+ }
+
+ OSMO_ASSERT(dl_win.distance() == 0);
+ OSMO_ASSERT(dl_win.window_empty());
+
+ dl_win.increment_send();
+ dl_win.increment_send();
+ dl_win.increment_send();
+ dl_win.increment_send();
+ OSMO_ASSERT(dl_win.distance() == 4);
+
+ for (int i = 0; i < 128; ++i) {
+ dl_win.increment_send();
+ dl_win.increment_send();
+ dl_win.raise(2);
+ OSMO_ASSERT(dl_win.distance() == 4);
+ }
+ }
+}
+
int main(int argc, char **argv)
{
printf("Making some basic type testing.\n");
@@ -141,6 +189,7 @@ int main(int argc, char **argv)
test_rlc();
test_rlc_v_b();
test_rlc_v_n();
+ test_rlc_dl_ul_basic();
return EXIT_SUCCESS;
}