aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@inria.fr>2026-04-26 16:57:47 +0200
committerTristan Riehs <tristan.riehs@inria.fr>2026-04-26 16:57:47 +0200
commit0c41b30e1534e4e23a1ff15eca50247579071d83 (patch)
tree72556ee1cce3c978eeb9655f365b7f67c97d0673 /test
Yet another project that will likely never be used by anyone
Diffstat (limited to 'test')
-rw-r--r--test/a.conf2
-rw-r--r--test/uconfig_test.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/test/a.conf b/test/a.conf
new file mode 100644
index 0000000..f7d4f66
--- /dev/null
+++ b/test/a.conf
@@ -0,0 +1,2 @@
+key0=value0
+key1=This is the value of key1
diff --git a/test/uconfig_test.c b/test/uconfig_test.c
new file mode 100644
index 0000000..fdb5cab
--- /dev/null
+++ b/test/uconfig_test.c
@@ -0,0 +1,15 @@
+#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"), "This is the value of key1") == 0);
+ uconfig_destroy(uconfig);
+ return 0;
+}