aboutsummaryrefslogtreecommitdiffstats
path: root/tests/alloc/MslotTest.cpp
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-02-05 16:15:30 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-02-27 22:27:53 +0100
commitdeeb68bebabb7a7fc749592145abeebb0ca7d3ad (patch)
treef595b62639f632c76e54b74a87dbeeba31bd443d /tests/alloc/MslotTest.cpp
parent321bf390d0ae41d2bce36433c468e410ae6fc840 (diff)
Simplify TS alloc: move slot check into functionsneels/master
Move timeslot applicability check outside of nested for loop into separate functions and document them. Add corresponding tests. This allows us to clarify types used in TS-related computations. Change-Id: Ic39e848da47dc11357782362fdf6206d2c1457c2 Related: OS#2282
Diffstat (limited to 'tests/alloc/MslotTest.cpp')
-rw-r--r--tests/alloc/MslotTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/alloc/MslotTest.cpp b/tests/alloc/MslotTest.cpp
index 1fa28bf5..92f92fae 100644
--- a/tests/alloc/MslotTest.cpp
+++ b/tests/alloc/MslotTest.cpp
@@ -27,6 +27,7 @@
#include <errno.h>
extern "C" {
+ #include "mslot_class.h"
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
@@ -137,6 +138,13 @@ static inline void test_multislot_ends(bool seq)
test_all_classes(trx, seq);
}
+static inline void test_window_wrapper()
+{
+ uint16_t i;
+ for (i = 0; i < 256 * 2 + 1; i++)
+ printf("W[%03u] -> %3u %s\n",
+ i, mslot_wrap_window(i), mslot_wrap_window(i) < 256 ? "OK" : "FAIL");
+}
int main(int argc, char **argv)
{
@@ -163,6 +171,8 @@ int main(int argc, char **argv)
test_multislot_ends(true);
test_multislot_ends(false);
+ test_window_wrapper();
+
return EXIT_SUCCESS;
}