From ee6cfdc0d9710e3a69c8e1939eb21c8f2b759885 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 13 Jul 2017 02:03:50 +0200 Subject: split off osmo-sgsn: remove files, apply build Change-Id: I5d27ff93e56cd13e0e70edd15e2080201e35e91f --- tests/trau/trau_test.c | 84 -------------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 tests/trau/trau_test.c (limited to 'tests/trau/trau_test.c') diff --git a/tests/trau/trau_test.c b/tests/trau/trau_test.c deleted file mode 100644 index c74e6dbb3..000000000 --- a/tests/trau/trau_test.c +++ /dev/null @@ -1,84 +0,0 @@ -/* (C) 2013 by Andreas Eversberg - * All Rights Reserved - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -#include -#include -#include - -#include -#include -#include - -void test_trau_fr_efr(unsigned char *data) -{ - struct decoded_trau_frame tf; - struct msgb *msg; - struct gsm_data_frame *frame; - - printf("Testing TRAU FR transcoding.\n"); - data[0] = 0xd0; - trau_encode_fr(&tf, data); - tf.c_bits[11] = 0; /* clear BFI */ - msg = trau_decode_fr(1, &tf); - OSMO_ASSERT(msg != NULL); - frame = (struct gsm_data_frame *)msg->data; - OSMO_ASSERT(frame->msg_type == GSM_TCHF_FRAME); - OSMO_ASSERT(!memcmp(frame->data, data, 33)); - msgb_free(msg); - - printf("Testing TRAU EFR transcoding.\n"); - data[0] = 0xc0; - trau_encode_efr(&tf, data); - OSMO_ASSERT(tf.d_bits[0] == 1); /* spare bit must be 1 */ - tf.c_bits[11] = 0; /* clear BFI */ - msg = trau_decode_efr(1, &tf); - OSMO_ASSERT(msg != NULL); - frame = (struct gsm_data_frame *)msg->data; - OSMO_ASSERT(frame->msg_type == GSM_TCHF_FRAME_EFR); - OSMO_ASSERT(!memcmp(frame->data, data, 31)); - - printf("Testing TRAU EFR decoding with CRC error.\n"); - tf.d_bits[0] = 0; /* spare bit must be included */ - msg = trau_decode_efr(1, &tf); - OSMO_ASSERT(msg != NULL); - frame = (struct gsm_data_frame *)msg->data; - OSMO_ASSERT(frame->msg_type == GSM_BAD_FRAME); - msgb_free(msg); -} - -int main() -{ - unsigned char data[33]; - int i; - - msgb_talloc_ctx_init(NULL, 0); - - memset(data, 0x00, sizeof(data)); - test_trau_fr_efr(data); - memset(data, 0xff, sizeof(data)); - test_trau_fr_efr(data); - srandom(42); - for (i = 0; i < sizeof(data); i++) - data[i] = random(); - test_trau_fr_efr(data); - printf("Done\n"); - return 0; -} - -/* stubs */ -void vty_out() {} -- cgit v1.2.3