fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/28083 )


Change subject: tests/meas: improve test_ts45008_83_is_sub_is_sub()
......................................................................

tests/meas: improve test_ts45008_83_is_sub_is_sub()

This function should also take lchan type into account.

Change-Id: I6920a04e0a6c846647fa1b6b3a3c80bbd6617b99
Related: SYS#5853
---
M tests/meas/meas_test.c
1 file changed, 47 insertions(+), 44 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/83/28083/1

diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c
index 32f0e7a..79ec358 100644
--- a/tests/meas/meas_test.c
+++ b/tests/meas/meas_test.c
@@ -395,51 +395,54 @@
        return false;
 }

-static bool test_ts45008_83_is_sub_is_sub(uint32_t fn, uint8_t ss)
+static bool test_ts45008_83_is_sub_is_sub(const struct gsm_lchan *lchan, 
uint32_t fn)
 {
        fn = fn % 104;

-       if (fn >= 52 && fn <= 59)
-               return true;
-
-       if (ss == 0) {
-               if (fn == 0)
-                       return true;
-               if (fn == 2)
-                       return true;
-               if (fn == 4)
-                       return true;
-               if (fn == 6)
-                       return true;
-               if (fn == 52)
-                       return true;
-               if (fn == 54)
-                       return true;
-               if (fn == 56)
-                       return true;
-               if (fn == 58)
-                       return true;
-       } else if (ss == 1) {
-               if (fn == 14)
-                       return true;
-               if (fn == 16)
-                       return true;
-               if (fn == 18)
-                       return true;
-               if (fn == 20)
-                       return true;
-               if (fn == 66)
-                       return true;
-               if (fn == 68)
-                       return true;
-               if (fn == 70)
-                       return true;
-               if (fn == 72)
-                       return true;
-       } else
-               OSMO_ASSERT(false);
-
-       return false;
+       switch (lchan->type) {
+       case GSM_LCHAN_TCH_F:
+               return (fn >= 52 && fn <= 59);
+       case GSM_LCHAN_TCH_H:
+               if (lchan->nr == 0) {
+                       if (fn == 0)
+                               return true;
+                       if (fn == 2)
+                               return true;
+                       if (fn == 4)
+                               return true;
+                       if (fn == 6)
+                               return true;
+                       if (fn == 52)
+                               return true;
+                       if (fn == 54)
+                               return true;
+                       if (fn == 56)
+                               return true;
+                       if (fn == 58)
+                               return true;
+               } else if (lchan->nr == 1) {
+                       if (fn == 14)
+                               return true;
+                       if (fn == 16)
+                               return true;
+                       if (fn == 18)
+                               return true;
+                       if (fn == 20)
+                               return true;
+                       if (fn == 66)
+                               return true;
+                       if (fn == 68)
+                               return true;
+                       if (fn == 70)
+                               return true;
+                       if (fn == 72)
+                               return true;
+               } else
+                       OSMO_ASSERT(false);
+               return false;
+       default:
+               return false;
+       }
 }

 static void test_ts45008_83_is_sub_single(uint8_t ts, uint8_t ss, bool fr)
@@ -472,12 +475,12 @@
                rc = ts45008_83_is_sub(lchan, i);
                if (rc) {
                        if (!test_ts45008_83_is_sub_is_sacch(i)
-                           && !test_ts45008_83_is_sub_is_sub(i, ss)) {
+                           && !test_ts45008_83_is_sub_is_sub(lchan, i)) {
                                printf("  ==> Unexpected SUB frame at fn=%u\n", 
i);
                        }
                } else {
                        if (test_ts45008_83_is_sub_is_sacch(i)
-                           && test_ts45008_83_is_sub_is_sub(i, ss)) {
+                           && test_ts45008_83_is_sub_is_sub(lchan, i)) {
                                printf("  ==> Unexpected non-SUB frame at 
fn=%u\n", i);
                        }
                }

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/28083
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I6920a04e0a6c846647fa1b6b3a3c80bbd6617b99
Gerrit-Change-Number: 28083
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to