interpret/test/test_kjv.c
2022-12-29 21:51:44 -08:00

25 lines
766 B
C

#include "../src/kjv.h"
#include <stdio.h>
#include <inttypes.h> /* C99 */
#include <stdlib.h>
#include <assert.h>
int main(void) {
int success = EXIT_SUCCESS;
struct kjv k = kjv();
fprintf(stderr, "%zu total words, %s.\n", k.words.total, kjv_to_string(&k));
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 });
kjv_add(&k, (union kjvcite){ .book = Genesis, .chapter = 1, .verse = 1 });
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);
goto finally;
catch:
success = EXIT_FAILURE, perror("kjv");
finally:
kjv_(&k);
return success;
}