summaryrefslogtreecommitdiffstats
path: root/tests/codec
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-05-31 02:42:46 +0200
committerHarald Welte <laforge@gnumonks.org>2017-06-09 08:10:03 +0000
commit3851e8ea7af8212c6bd86d870277eb1c238b6e78 (patch)
tree613c0d3b6faf841911f099383972f0ccac0da86b /tests/codec
parent0d49f47aeb5a38273c4a356dc4780e3819747d60 (diff)
introduce proper test case for GSM FR detection
our code is actually wrong, so let's skip the test until the fix is applied in a follow-up patch. Change-Id: I710c7871f959671deb3d18ab9062588f3056fd7c
Diffstat (limited to 'tests/codec')
-rw-r--r--tests/codec/codec_test.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/tests/codec/codec_test.c b/tests/codec/codec_test.c
index f944f38b..b204d771 100644
--- a/tests/codec/codec_test.c
+++ b/tests/codec/codec_test.c
@@ -94,6 +94,100 @@ static void test_sid_xr(uint8_t *t, size_t len, bool hr)
hr ? osmo_hr_check_sid(t, len) : osmo_fr_check_sid(t, len));
}
+const uint8_t fr_sid1[33] = { 0xd7, 0xe0, 0xa3, 0x61, 0x2c, 0x00, 0x00,
+ 0x80, 0x49, 0x00, 0x00, 0x49, 0x00, 0x00, 0x80, 0x00, 0x04,
+ 0x00, 0x00, 0x00, 0x00, 0x12, 0x40, 0x00, 0x10, 0x08, 0x00,
+ 0x00, 0x00, 0x08, 0x2d, 0x04, 0x09 };
+
+const uint8_t fr_sid2[33] = { 0xd7, 0xa2, 0xbb, 0x65, 0xe5, 0x00, 0x00,
+ 0x10, 0x00, 0x04, 0x82, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00,
+ 0x02, 0x41, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x01, 0x00,
+ 0x00, 0x00, 0x42, 0x40, 0x10, 0xd2 };
+
+const uint8_t fr_sid3[33] = { 0xd9, 0x60, 0xab, 0x21, 0xea, 0x00, 0x00,
+ 0x80, 0x48, 0x20, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x24,
+ 0x80, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x10, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x08 };
+
+const uint8_t fr_sid4[33] = { 0xd8, 0x21, 0xab, 0x25, 0xea, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x02, 0x41, 0x00,
+ 0x02, 0x48, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x42, 0x00, 0x02, 0x50 };
+
+const uint8_t fr_sid5[33] = { 0xd9, 0x61, 0x9a, 0x65, 0x60, 0x00, 0x00,
+ 0x10, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x00, 0x02, 0x40, 0x82, 0x52 };
+
+const uint8_t fr_sid6[33] = { 0xd9, 0xa5, 0x93, 0xe1, 0xa0, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x09, 0x00,
+ 0x02, 0x40, 0x00, 0x00, 0x00, 0x01, 0x20, 0x80, 0x01, 0x00,
+ 0x00, 0x90, 0x02, 0x40, 0x02, 0x02 };
+
+const uint8_t fr_sid7[33] = { 0xd8, 0x20, 0xa3, 0xe5, 0xaa, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x04,
+ 0x80, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x12, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x09 };
+
+const uint8_t fr_sid8[33] = { 0xd7, 0xe0, 0xa3, 0xa1, 0x60, 0x00, 0x00,
+ 0x10, 0x00, 0x04, 0x92, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x12, 0x00, 0x40, 0x12, 0x00 };
+
+const uint8_t fr_sid9[33] = { 0xd8, 0x20, 0xa3, 0xa5, 0x62, 0x00, 0x00,
+ 0x10, 0x00, 0x04, 0x82, 0x00, 0x00, 0x00, 0x02, 0x49, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x24, 0x00, 0x00, 0x00,
+ 0x00, 0x10, 0x02, 0x00, 0x82, 0x02 };
+
+const uint8_t fr_sid10[33] = { 0xd4, 0xaa, 0xba, 0x6e, 0xbb, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x20,
+ 0x90, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x08, 0x00,
+ 0x00, 0x00, 0x08, 0x2c, 0x20, 0x00 };
+
+const uint8_t fr_sid11[33] = { 0xd9, 0x64, 0xbb, 0x6d, 0x62, 0x00, 0x00,
+ 0x80, 0x41, 0x00, 0x00, 0x48, 0x00, 0x00, 0x10, 0x00, 0x04,
+ 0x90, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x2c, 0x24, 0x01 };
+
+const uint8_t fr_sid12[33] = { 0xd8, 0x61, 0xb2, 0xa5, 0x62, 0x00, 0x00,
+ 0x00, 0x41, 0x20, 0x00, 0x48, 0x00, 0x00, 0x10, 0x00, 0x04,
+ 0x90, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x10, 0x40, 0x00,
+ 0x00, 0x00, 0x01, 0x29, 0x24, 0x08 };
+
+const uint8_t fr_sid13[33] = { 0xd9, 0x23, 0xba, 0xe5, 0xe2, 0x00, 0x00,
+ 0x80, 0x41, 0x20, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x04,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x09, 0x05, 0x20, 0x00 };
+
+const uint8_t fr_sid14[33] = { 0xd8, 0x62, 0xa2, 0x61, 0x60, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x80, 0x00, 0x40, 0x02, 0x40 };
+
+const uint8_t fr_sid15[33] = { 0xd9, 0xe4, 0xc3, 0x6d, 0x12, 0x00, 0x00,
+ 0x80, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x48, 0x00, 0x10, 0x48, 0x00,
+ 0x00, 0x00, 0x00, 0x2d, 0x04, 0x00 };
+
+const uint8_t fr_sid16[33] = { 0xd9, 0xa4, 0xc3, 0x29, 0x59, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x42, 0x00, 0x12, 0x02 };
+
+static const uint8_t *fr_sids[] = { fr_sid1, fr_sid2, fr_sid3, fr_sid4,
+ fr_sid5, fr_sid6, fr_sid7, fr_sid8, fr_sid9, fr_sid10, fr_sid11,
+ fr_sid12, fr_sid13, fr_sid14, fr_sid15, fr_sid16 };
+
+static void test_sid_fr(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(fr_sids); i++) {
+ int rc = osmo_fr_check_sid(fr_sids[i], 33);
+ printf("FR SID %s: %d\n", osmo_hexdump(fr_sids[i], 33), rc);
+ }
+}
+
int main(int argc, char **argv)
{
printf("AMR RTP payload decoder test:\n");
@@ -114,6 +208,9 @@ int main(int argc, char **argv)
test_sid_xr(sid_hr, 14, true);
test_sid_xr(hr, 14, true);
+ printf("FR RTP payload SID test:\n");
+ test_sid_fr();
+
return 0;
}