2 * (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de>
3 * (C) 2010 by Nico Golde <nico@ngolde.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include <sys/types.h>
26 #include <osmocore/msgb.h>
27 #include <osmocore/gsm_utils.h>
29 int main(int argc, char** argv)
31 printf("SMS testing\n");
36 /* test 7-bit coding/decoding */
37 const char *input = "test text";
42 length = gsm_7bit_encode(coded, input);
43 gsm_7bit_decode(result, coded, length);
44 if (strcmp(result, input) != 0) {
45 printf("7 Bit coding failed... life sucks\n");
46 printf("Wanted: '%s' got '%s'\n", input, result);
50 memset(coded, 0, sizeof(coded));
51 memset(result, 0, sizeof(coded));
52 input = strdup("!$ a more#^- complicated test@@?_\%! case");
53 length = gsm_7bit_encode(coded, input);
54 gsm_7bit_decode(result, coded, length);
55 if (strcmp(result, input) != 0) {
56 printf("7 Bit coding failed... life sucks\n");
57 printf("Wanted: '%s' got '%s'\n", input, result);