summaryrefslogtreecommitdiff
path: root/32_kvs/kv_test.c
diff options
context:
space:
mode:
Diffstat (limited to '32_kvs/kv_test.c')
-rw-r--r--32_kvs/kv_test.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/32_kvs/kv_test.c b/32_kvs/kv_test.c
new file mode 100644
index 0000000..5532512
--- /dev/null
+++ b/32_kvs/kv_test.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "kv.h"
+
+#define NUM_LOOKUPS 5
+int main(void) {
+ kvarray_t * array = readKVs("test.txt");
+ printf("Printing all keys\n\n");
+ printKVs(array);
+ char *tests[NUM_LOOKUPS] = {"banana", "grapes", "cantaloupe", "lettuce", "orange"};
+ for (int i = 0; i < NUM_LOOKUPS; i++) {
+ printf("lookupValue('%s')=%s\n", tests[i], lookupValue(array,tests[i]));
+ }
+ freeKVs(array);
+ return EXIT_SUCCESS;
+}