blob: b8a9db71d5c90c8b37bd1e36ed88f144713e0ecb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <assert.h>
#include <string.h>
#include <uconfig.h>
int main(void)
{
struct uconfig_s *uconfig = uconfig_new("a.conf");
char *value;
if (uconfig == NULL)
uconfig = uconfig_new("./test/a.conf");
assert(uconfig != NULL);
value = uconfig_get(uconfig, "key0");
assert(value != NULL);
assert(strcmp(value, "value0") == 0);
value = uconfig_get(uconfig, "key1");
assert(value != NULL);
assert(strcmp(value, "value1 with spaces around the equal character") == 0);
value = uconfig_get(uconfig, "key2");
assert(value != NULL);
assert(strcmp(value, "value2 with spaces at the beginning of the line") == 0);
value = uconfig_get(uconfig, "key3");
assert(value != NULL);
assert(strcmp(value, "value3 with a tab at the beginning of the line") == 0);
value = uconfig_get(uconfig, "key4");
assert(value != NULL);
assert(strcmp(value, "value4 with spaces at the end of the line") == 0);
uconfig_destroy(uconfig);
return 0;
}
|