Translation update done using Pootle.
[gammu.git] / tests / features-parsing.c
blobf31c7be0ad60ade03af96c58445ae20fadbdef45
1 /* Sample code to dump all feature codes and their descriptions */
3 #include <gammu.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <string.h>
8 #include "../libgammu/gsmphones.h"
10 int single_test(const char *string, GSM_Error expected)
12 GSM_Feature features[GSM_MAX_PHONE_FEATURES + 1];
13 GSM_Error real;
15 real = GSM_SetFeatureString(features, string);
17 if (real != expected) {
18 printf("Failed parsing of %s (got %s, expected %s)\n", string, GSM_ErrorString(real), GSM_ErrorString(expected));
19 return 1;
21 return 0;
24 int main(int argc, char **argv)
26 int rc = 0;
27 GSM_Debug_Info *debug_info;
29 debug_info = GSM_GetGlobalDebug();
30 GSM_SetDebugFileDescriptor(stderr, FALSE, debug_info);
31 GSM_SetDebugLevel("textall", debug_info);
33 rc |= single_test("CAL33, CAL52,SQWE", ERR_NONE);
34 rc |= single_test("CAL33, FOO,SQWE", ERR_BADFEATURE);
35 rc |= single_test("CAL33, NO_ATOBEX ,SQWE", ERR_NONE);
36 rc |=
37 single_test
38 ("CAL33, NO_ATOBEX ,SQWE, CAL33, NO_ATOBEX ,SQWE, CAL52,CAL33, NO_ATOBEX ,SQWE, CAL33, NO_ATOBEX ,SQWE, CAL52,CAL33, NO_ATOBEX ,SQWE, CAL33, NO_ATOBEX ,SQWE, CAL52",
39 ERR_MOREMEMORY);
41 return rc;
44 /* Editor configuration
45 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: