interpret/test/test_kjv.c

25 lines
766 B
C
Raw Normal View History

2022-12-27 15:28:04 -05:00
#include "../src/kjv.h"
#include <stdio.h>
#include <inttypes.h> /* C99 */
#include <stdlib.h>
2022-12-27 16:55:58 -05:00
#include <assert.h>
2022-12-27 15:28:04 -05:00
int main(void) {
2022-12-27 16:48:45 -05:00
int success = EXIT_SUCCESS;
2022-12-27 15:28:04 -05:00
struct kjv k = kjv();
2022-12-30 00:51:44 -05:00
fprintf(stderr, "%zu total words, %s.\n", k.words.total, kjv_to_string(&k));
2022-12-27 16:48:45 -05:00
if(!kjv_is_valid(&k)) goto catch;
kjv_add(&k, (union kjvcite){ .book = Genesis, .chapter = 1, .verse = 1 });
kjv_add(&k, (union kjvcite){ .book = Genesis, .chapter = 1, .verse = 2 });
2022-12-27 16:01:51 -05:00
kjv_add(&k, (union kjvcite){ .book = Genesis, .chapter = 1, .verse = 1 });
2022-12-30 00:51:44 -05:00
fprintf(stderr, "%zu of which: %s.\n", k.words.set, kjv_set_to_string(&k));
assert(k.words.total == 789633);
assert(k.words.set == 39);
2022-12-27 16:48:45 -05:00
goto finally;
catch:
success = EXIT_FAILURE, perror("kjv");
finally:
2022-12-27 15:28:04 -05:00
kjv_(&k);
2022-12-27 16:48:45 -05:00
return success;
2022-12-27 15:28:04 -05:00
}