aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHolger Freyther <zecke@selfish.org>2009-02-23 00:50:38 +0000
committerHolger Freyther <zecke@selfish.org>2009-02-23 00:50:38 +0000
commit59da07bd0eae1fb58f446bfcecbe80c710f401e8 (patch)
treeb130db3ca05ff23b0275dd442253a479b9d93774 /tests
parent73e61c4cd68db450de5a2ad1d0377b40d6429484 (diff)
[sms] Add test case for the 7-bit coding/decoding...
we don't pass it yet.
Diffstat (limited to 'tests')
-rw-r--r--tests/sms/sms_test.c17
1 files changed, 17 insertions, 0 deletions
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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <openbsc/debug.h>
#include <openbsc/msgb.h>
#include <openbsc/gsm_04_11.h>
#include <openbsc/gsm_04_08.h>
+#include <openbsc/gsm_utils.h>
/* 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<SMS_NUM;i++) {
/* Setup SMS msgb */
msg = msgb_alloc(sms_data[i].len);