aboutsummaryrefslogtreecommitdiff
path: root/test/uconfig_test.c
blob: b4f10018ba49800ca2f54b9ad3eb293b95dc66bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <assert.h>
#include <string.h>
#include <uconfig.h>

int main(void)
{
	struct uconfig_s *uconfig = uconfig_new("a.conf");
	if (uconfig == NULL)
		uconfig = uconfig_new("./test/a.conf");
	assert(uconfig != NULL);
	assert(strcmp(uconfig_get(uconfig, "key0"), "value0") == 0);
	assert(strcmp(uconfig_get(uconfig, "key1"), "value1 with spaces around the equal character") == 0);
	assert(strcmp(uconfig_get(uconfig, "key2"), "value2 with spaces at the beginning of the line") == 0);
	assert(strcmp(uconfig_get(uconfig, "key3"), "value3 with a tab at the beginning of the line") == 0);
	assert(strcmp(uconfig_get(uconfig, "key4"), "value4 with spaces at the end of the line") == 0);
	uconfig_destroy(uconfig);
	return 0;
}