summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_questions.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_questions.c b/tests/test_questions.c
new file mode 100644
index 0000000..c605c1a
--- /dev/null
+++ b/tests/test_questions.c
@@ -0,0 +1,24 @@
1#include "questions.h"
2#include <stdio.h>
3#include <stdlib.h>
4
5int main(void) {
6 QuestionSet qs;
7
8 if (load_questions("data/questions.txt", &qs) != EXIT_SUCCESS) {
9 fprintf(stderr, "TEST FAILED: cannot load file\n");
10 return EXIT_FAILURE;
11 }
12
13 if (qs.general_count == 0 || qs.major_count == 0) {
14 fprintf(stderr, "TEST FAILED: empty sets\n");
15 free_questions(&qs);
16 return EXIT_FAILURE;
17 }
18
19 printf("TEST OK: loaded %zu general, %zu major\n", qs.general_count,
20 qs.major_count);
21
22 free_questions(&qs);
23 return EXIT_SUCCESS;
24}