aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/tests/channel/channel_test.c31
-rw-r--r--openbsc/tests/channel/channel_test.ok1
2 files changed, 32 insertions, 0 deletions
diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c
index 20128325e..668644dd9 100644
--- a/openbsc/tests/channel/channel_test.c
+++ b/openbsc/tests/channel/channel_test.c
@@ -90,11 +90,42 @@ void test_request_chan(void)
OSMO_ASSERT(s_end);
}
+void test_dyn_ts_subslots(void)
+{
+ struct gsm_bts_trx_ts ts;
+
+ printf("Testing subslot numbers for pchan types\n");
+
+ ts.pchan = GSM_PCHAN_TCH_F;
+ OSMO_ASSERT(ts_subslots(&ts) == 1);
+
+ ts.pchan = GSM_PCHAN_TCH_H;
+ OSMO_ASSERT(ts_subslots(&ts) == 2);
+
+ ts.pchan = GSM_PCHAN_PDCH;
+ OSMO_ASSERT(ts_subslots(&ts) == 0);
+
+ ts.pchan = GSM_PCHAN_TCH_F_PDCH;
+ ts.flags = 0; /* TCH_F mode */
+ OSMO_ASSERT(ts_subslots(&ts) == 1);
+ ts.flags = TS_F_PDCH_ACTIVE;
+ OSMO_ASSERT(ts_subslots(&ts) == 1 /* SHOULD BE 0 */);
+
+ ts.pchan = GSM_PCHAN_TCH_F_TCH_H_PDCH;
+ ts.dyn.pchan_is = GSM_PCHAN_TCH_F;
+ OSMO_ASSERT(ts_subslots(&ts) == 1);
+ ts.dyn.pchan_is = GSM_PCHAN_TCH_H;
+ OSMO_ASSERT(ts_subslots(&ts) == 2);
+ ts.dyn.pchan_is = GSM_PCHAN_PDCH;
+ OSMO_ASSERT(ts_subslots(&ts) == 0);
+}
+
int main(int argc, char **argv)
{
osmo_init_logging(&log_info);
test_request_chan();
+ test_dyn_ts_subslots();
return EXIT_SUCCESS;
}
diff --git a/openbsc/tests/channel/channel_test.ok b/openbsc/tests/channel/channel_test.ok
index 7976aee0f..33c819350 100644
--- a/openbsc/tests/channel/channel_test.ok
+++ b/openbsc/tests/channel/channel_test.ok
@@ -1,2 +1,3 @@
Testing the gsm_subscriber chan logic
Reached, didn't crash, test passed
+Testing subslot numbers for pchan types