From 0cb3dab6b0fc4b5ebe00c0afaaceb68dcf98c6dc Mon Sep 17 00:00:00 2001 From: bpc2003 Date: Fri, 23 May 2025 14:23:10 -0400 Subject: Migrating from personal testing framework to Unity --- tests/test_engine.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_engine.c (limited to 'tests/test_engine.c') diff --git a/tests/test_engine.c b/tests/test_engine.c new file mode 100644 index 0000000..f772c36 --- /dev/null +++ b/tests/test_engine.c @@ -0,0 +1,26 @@ +#include +#include + +#include "../unity/unity.h" +#include "../src/include/engine/engine.h" + +extern tablist_t *list; + +void test_readdb(void) { + tablist_t *db = readdb("dbs/test.xdb"); + TEST_ASSERT_NOT_NULL(db); + delkeys(db, -1, NULL, 0); + free(db); +} + +void test_getkeys(void) { + tablist_t *tmp = getkeys(list, -1, NULL, 0); + TEST_ASSERT_NOT_NULL(tmp); + for (int i = 0; i < tmp[0].len; ++i) { + printf("id: %d\t", i); + for (int j = 0; tmp[i].tab[j].flag; ++j) + printf("%s\t", tmp[i].tab[j].key); + printf("\n"); + } + free(tmp); +} -- cgit v1.2.3