aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2024-08-02 18:00:00 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2024-08-02 18:00:00 +0200
commit8acab012bff56dd8b538d60c76dc084637887895 (patch)
treec3f5007126bc3f86720be7101087340c559b9011 /test
parent7f2bb3643dd8781be4b5c1d3364f591e572c82e7 (diff)
downloadproperties-8acab012bff56dd8b538d60c76dc084637887895.tar.gz
properties-8acab012bff56dd8b538d60c76dc084637887895.zip
Add test directory
Diffstat (limited to 'test')
-rw-r--r--test/Makefile6
-rw-r--r--test/main.c22
2 files changed, 28 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..8215134
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,6 @@
+test:
+ cc -c main.c -o main.o
+ cc main.o -L.. -l:libproperties.a -o $@
+
+clean:
+ rm -rf test
diff --git a/test/main.c b/test/main.c
new file mode 100644
index 0000000..479c5fa
--- /dev/null
+++ b/test/main.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void properties_load(FILE *file);
+
+int
+main(int argc, char **argv)
+{
+ FILE *file;
+
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-f") == 0 && (i + 1) < argc) {
+ file = fopen(argv[i + 1], "r");
+ break;
+ }
+ }
+
+ properties_load(file);
+
+ return EXIT_SUCCESS;
+}