diff options
| author | Filip Wandzio <contact@philw.dev> | 2026-03-01 17:45:00 +0100 |
|---|---|---|
| committer | Filip Wandzio <contact@philw.dev> | 2026-03-01 17:45:00 +0100 |
| commit | 9e9c1b21569faeabd33716e4153a881e2eed7134 (patch) | |
| tree | f3a7ad21aed4b1c4f51c3ee308ffef88430deafc /tests | |
| parent | 57b077a4788b7fb5ed6add1df4ba3f15c9e6349b (diff) | |
| download | ysnp-9e9c1b21569faeabd33716e4153a881e2eed7134.tar.gz ysnp-9e9c1b21569faeabd33716e4153a881e2eed7134.zip | |
Signed-off-by: Filip Wandzio <contact@philw.dev>
Diffstat (limited to '')
| -rw-r--r-- | tests/test_questions.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/test_questions.c b/tests/test_questions.c index c605c1a..334ab86 100644 --- a/tests/test_questions.c +++ b/tests/test_questions.c | |||
| @@ -1,24 +1,26 @@ | |||
| 1 | #include "questions.h" | 1 | #include "../include/questions.h" |
| 2 | #include <stdio.h> | 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
| 4 | 4 | ||
| 5 | int main(void) { | 5 | int main(void) |
| 6 | QuestionSet qs; | 6 | { |
| 7 | QuestionSet qs; | ||
| 7 | 8 | ||
| 8 | if (load_questions("data/questions.txt", &qs) != EXIT_SUCCESS) { | 9 | if (load_questions("data/questions.txt", &qs) != EXIT_SUCCESS) { |
| 9 | fprintf(stderr, "TEST FAILED: cannot load file\n"); | 10 | fprintf(stderr, "TEST FAILED: cannot load file\n"); |
| 10 | return EXIT_FAILURE; | 11 | return EXIT_FAILURE; |
| 11 | } | 12 | } |
| 12 | 13 | ||
| 13 | if (qs.general_count == 0 || qs.major_count == 0) { | 14 | if (qs.general_count == 0 || qs.major_count == 0) { |
| 14 | fprintf(stderr, "TEST FAILED: empty sets\n"); | 15 | fprintf(stderr, "TEST FAILED: empty sets\n"); |
| 15 | free_questions(&qs); | 16 | free_questions(&qs); |
| 16 | return EXIT_FAILURE; | 17 | return EXIT_FAILURE; |
| 17 | } | 18 | } |
| 18 | 19 | ||
| 19 | printf("TEST OK: loaded %zu general, %zu major\n", qs.general_count, | 20 | printf("TEST OK: loaded %zu general, %zu major\n", |
| 20 | qs.major_count); | 21 | qs.general_count, |
| 22 | qs.major_count); | ||
| 21 | 23 | ||
| 22 | free_questions(&qs); | 24 | free_questions(&qs); |
| 23 | return EXIT_SUCCESS; | 25 | return EXIT_SUCCESS; |
| 24 | } | 26 | } |
