From 59da07bd0eae1fb58f446bfcecbe80c710f401e8 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Mon, 23 Feb 2009 00:50:38 +0000 Subject: [sms] Add test case for the 7-bit coding/decoding... we don't pass it yet. --- tests/sms/sms_test.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/sms/sms_test.c b/tests/sms/sms_test.c index 63917a055..bd628d191 100644 --- a/tests/sms/sms_test.c +++ b/tests/sms/sms_test.c @@ -19,11 +19,14 @@ */ #include +#include +#include #include #include #include #include #include +#include /* SMS data from MS starting with layer 3 header */ static u_int8_t sms1[] = { @@ -74,6 +77,20 @@ int main(int argc, char** argv) u_int8_t *sms; u_int8_t i; + /* test 7-bit coding/decoding */ + const char *input = "test text"; + u_int8_t length; + u_int8_t *coded = gsm_7bit_encode(input, &length); + char *result = gsm_7bit_decode(coded, length); + if (strcmp(result, input) != 0) { + printf("7 Bit coding failed... life sucks\n"); + printf("Wanted: '%s' got '%s'\n", input, result); + } + + free(coded); + free(result); + + for(i=0;i