aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@inria.fr>2026-05-03 15:41:19 +0200
committerTristan Riehs <tristan.riehs@inria.fr>2026-05-03 15:41:19 +0200
commit46cbb3b4393d690ff023d4339ac3268fba6774d5 (patch)
tree6f826feea6427e2aaeaf0d56053924b2d9a5f1ed
parentffff223b04b2760ac4fdc2c5c5bce74a5db68ed5 (diff)
Check the pointer value in the test
-rw-r--r--test/uconfig_test.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/test/uconfig_test.c b/test/uconfig_test.c
index b4f1001..b8a9db7 100644
--- a/test/uconfig_test.c
+++ b/test/uconfig_test.c
@@ -5,14 +5,33 @@
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);
- 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);
+
+
+ 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;
}