diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-23 14:23:10 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-23 14:23:10 -0400 |
commit | 0cb3dab6b0fc4b5ebe00c0afaaceb68dcf98c6dc (patch) | |
tree | 468adce03e77dc837d022d99d0b07260626123c0 /tests/test_engine.c | |
parent | 175c04f2972c2a65e29ba2456ba5d058c35dcf87 (diff) |
Migrating from personal testing framework to Unity
Diffstat (limited to 'tests/test_engine.c')
-rw-r--r-- | tests/test_engine.c | 26 |
1 files changed, 26 insertions, 0 deletions
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 <stdio.h> +#include <stdlib.h> + +#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); +} |