interpret/test/test_kjv.c
2022-12-27 13:55:58 -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.total_words, 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.set_words, kjv_set_to_string(&k));
assert(k.total_words == 789633);
assert(k.set_words == 39);
goto finally;
catch:
success = EXIT_FAILURE, perror("kjv");
finally:
kjv_(&k);
return success;
}