aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-29 14:18:46 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-03 13:17:22 +0200
commitac89a555fa73b24a77bb861811774a5af885bc84 (patch)
treed0edad2d9003d7355f5637e61aa4f8f2f73879f8 /tests
parent699b8dca49df30b7bf6db7090eb416d1ad4fd46d (diff)
ms: Add tbf() method to get the TBF based on the direction
To avoid the need for a switch or conditional statement when needing a TBF from an MS object in direction independant code, this method contains that case distinction. For additional flexibility, a reverse() function is added to get the opposite direction. Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests')
-rw-r--r--tests/ms/MsTest.cpp3
-rw-r--r--tests/tbf/TbfTest.cpp12
-rw-r--r--tests/tbf/TbfTest.ok2
3 files changed, 17 insertions, 0 deletions
diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp
index f2faefc..5a25d76 100644
--- a/tests/ms/MsTest.cpp
+++ b/tests/ms/MsTest.cpp
@@ -69,6 +69,9 @@ static void test_ms_state()
OSMO_ASSERT(ms->ul_tbf() == ul_tbf);
OSMO_ASSERT(ms->dl_tbf() == dl_tbf);
+ OSMO_ASSERT(ms->tbf(GPRS_RLCMAC_UL_TBF) == ul_tbf);
+ OSMO_ASSERT(ms->tbf(GPRS_RLCMAC_DL_TBF) == dl_tbf);
+
ms->detach_tbf(ul_tbf);
OSMO_ASSERT(!ms->is_idle());
OSMO_ASSERT(ms->ul_tbf() == NULL);
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index c9b01db..47c090a 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -61,6 +61,17 @@ static unsigned inc_fn(fn)
}
*/
+static void test_tbf_base()
+{
+
+ printf("=== start %s ===\n", __func__);
+
+ OSMO_ASSERT(GPRS_RLCMAC_DL_TBF == reverse(GPRS_RLCMAC_UL_TBF));
+ OSMO_ASSERT(GPRS_RLCMAC_UL_TBF == reverse(GPRS_RLCMAC_DL_TBF));
+
+ printf("=== end %s ===\n", __func__);
+}
+
static void test_tbf_tlli_update()
{
BTS the_bts;
@@ -667,6 +678,7 @@ int main(int argc, char **argv)
vty_init(&pcu_vty_info);
pcu_vty_init(&debug_log_info);
+ test_tbf_base();
test_tbf_tlli_update();
test_tbf_final_ack(TEST_MODE_STANDARD);
test_tbf_final_ack(TEST_MODE_REVERSE_FREE);
diff --git a/tests/tbf/TbfTest.ok b/tests/tbf/TbfTest.ok
index 8c2c0e7..274f069 100644
--- a/tests/tbf/TbfTest.ok
+++ b/tests/tbf/TbfTest.ok
@@ -1,3 +1,5 @@
+=== start test_tbf_base ===
+=== end test_tbf_base ===
=== start test_tbf_delayed_release ===
=== end test_tbf_delayed_release ===
=== start test_tbf_imsi ===