summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-24 23:18:42 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-24 23:41:40 +0700
commit34ed228b0f984ab8684565c98ebed69e2c0a46a3 (patch)
tree40477019b92bde5f8e0024d53c05c5e7f8c020ad
parent3bb3b602d09e2200369a89517d63c9237f313c7e (diff)
BTS_Tests/DTX: get rid of f_g_chan_is_{tchf,tchh,sdcch4,sdcch8}
TTCN-3 offers templates and pattern matching, so no need to match against all possible variants of the RSL channel number. Change-Id: I104595c4a96617f8000f803d19a890cff0b02744 Related: OS#4801
-rw-r--r--bts/BTS_Tests.ttcn58
1 files changed, 14 insertions, 44 deletions
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 9935014..fa6ca0c 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -6705,35 +6705,6 @@ testcase TC_lapdm_selftest() runs on test_CT {
/***********************************************************************
* DTX Related (see GSM 05.08, section 8.3)
***********************************************************************/
-
-/* XXX These functions must be kept in sync with g_AllChannels defined on test_CT. */
-private function f_g_chan_is_tchf() runs on ConnHdlr return boolean {
- return (g_chan_nr == valueof(ts_RslChanNr_Bm(1)) or
- g_chan_nr == valueof(ts_RslChanNr_Bm(2)) or
- g_chan_nr == valueof(ts_RslChanNr_Bm(3)) or
- g_chan_nr == valueof(ts_RslChanNr_Bm(4)));
-}
-private function f_g_chan_is_tchh() runs on ConnHdlr return boolean {
- return (g_chan_nr == valueof(ts_RslChanNr_Lm(5,0)) or
- g_chan_nr == valueof(ts_RslChanNr_Lm(5,1)));
-}
-private function f_g_chan_is_sdcch4() runs on ConnHdlr return boolean {
- return (g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,0)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,1)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,2)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,3)));
-}
-private function f_g_chan_is_sdcch8() runs on ConnHdlr return boolean {
- return (g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,0)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,1)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,2)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,3)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,4)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,5)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,6)) or
- g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,7)));
-}
-
private function f_test_l2_fill_frames(boolean dtxd) runs on ConnHdlr {
var L1ctlDlMessage dl;
var octetstring l2_fill_frame := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O;
@@ -6780,7 +6751,7 @@ private function f_test_l2_fill_frames(boolean dtxd) runs on ConnHdlr {
}
if (dtxd) {
- if (not f_g_chan_is_tchf()) {
+ if (not match(g_chan_nr, t_RslChanNr_Bm(?))) {
T.stop;
f_rsl_chan_deact();
f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
@@ -6832,20 +6803,19 @@ private function f_test_l2_fill_frames(boolean dtxd) runs on ConnHdlr {
}
if (fn > first_fn + frame_dtx_tchf_mod) {
T.stop;
- if (f_g_chan_is_tchf()) {
- /* Without DTX we can expect 25 fill frames for every 104 frames.
- * (24 FACCH + 1 SACCH filling) */
- expected_fill_frames := 25;
- } else if (f_g_chan_is_tchh()) {
- /* We can expect 2 fill frames for every 104 frames. */
- expected_fill_frames := 2;
- } else if (f_g_chan_is_sdcch4() or f_g_chan_is_sdcch8()) {
- /* We can expect 5 fill frames for every 104 frames. */
- expected_fill_frames := 5;
- } else {
- f_rsl_chan_deact();
- f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknown channel type");
+
+ select (g_chan_nr) {
+ /* TCH/F: we expect 25 fill frames (24 FACCH + 1 SACCH) for every 104 frames. */
+ case (t_RslChanNr_Bm(?)) { expected_fill_frames := 25; }
+ /* TCH/H: we expect 2 fill frames for every 104 frames. */
+ case (t_RslChanNr_Lm(?, ?)) { expected_fill_frames := 2; }
+ /* SDCCH: we expect 5 fill frames for every 104 frames. */
+ case (t_RslChanNr_SDCCH4(?, ?)) { expected_fill_frames := 5; }
+ case (t_RslChanNr_SDCCH8(?, ?)) { expected_fill_frames := 5; }
+ case else {
+ /* This shall not happen, just to be sure */
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
}
f_rsl_chan_deact();