2 * INI file parsing tests.
11 int main(int argc
, char **argv
)
14 INI_Section
*ini
= NULL
;
19 /* Check parameters */
21 printf("Not enough parameters!\nUsage: inifile ini_file\n");
25 error
= INI_ReadFile(argv
[1], FALSE
, &ini
);
26 gammu_test_result(error
, "INI_ReadFile");
27 test_result(ini
!= NULL
);
29 intval
= INI_GetInt(ini
, "section", "intval", -1);
30 test_result(intval
== 65536);
32 boolval
= INI_GetBool(ini
, "section", "trueval", FALSE
);
33 test_result(boolval
== TRUE
);
35 boolval
= INI_GetBool(ini
, "section", "falseval", TRUE
);
36 test_result(boolval
== FALSE
);
38 boolval
= INI_GetBool(ini
, "section", "notexistingval", TRUE
);
39 test_result(boolval
== TRUE
);
41 boolval
= INI_GetBool(ini
, "section", "intval", FALSE
);
42 test_result(boolval
== FALSE
);
44 boolval
= INI_GetBool(ini
, "section", "intval", TRUE
);
45 test_result(boolval
== TRUE
);
47 strval
= INI_GetValue(ini
, "section", "val1", FALSE
);
48 test_result(strval
!= NULL
);
49 test_result(strcmp(strval
, "ABCDE abcde") == 0);