{
void* ptr = malloc(size);
if (ptr == NULL) {
+ // LCOV_EXCL_START
+ // exclude from coverage analysis because we can't simulate an out of memory error in testing
fprintf(stderr, "Out of memory!\n");
exit(EXIT_FAILURE);
+ // LCOV_EXCL_STOP
}
return (ptr);
}
input = NULL;
size_t n = 0;
if (isatty(0))
+ // LCOV_EXCL_START
+ // Should be unreachable in tests, as they will use a non-interactive shell.
printf("%s", input_prompt);
+ // LCOV_EXCL_STOP
IGNORE(getline(&input, &n, stdin));
}
speak(question);
reply = get_input();
- if (reply == NULL) {
- linenoiseFree(reply);
- exit(EXIT_SUCCESS);
- }
+ if (reply == NULL) {
+ // LCOV_EXCL_START
+ // Should be unreachable. Reply should never be NULL
+ linenoiseFree(reply);
+ exit(EXIT_SUCCESS);
+ // LCOV_EXCL_STOP
+ }
char* firstword = (char*) xmalloc(strlen(reply)+1);
sscanf(reply, "%s", firstword);
lexeme = -1;
if (init < 0)
return (lexeme);
- BUG(REQUIRED_VOCABULARY_WORD_NOT_FOUND);
+ BUG(REQUIRED_VOCABULARY_WORD_NOT_FOUND); // LCOV_EXCL_LINE
}
if (init >= 0 && KTAB[i] / 1000 != init)
continue;
return (lexeme);
}
}
- BUG(RAN_OFF_END_OF_VOCABULARY_TABLE);
+ BUG(RAN_OFF_END_OF_VOCABULARY_TABLE); // LCOV_EXCL_LINE
}
void juggle(long object)
*t = (long) tv.tv_usec;
}
+// LCOV_EXCL_START
void bug(enum bugtype num, const char *error_string)
{
fprintf(stderr, "Fatal error %d, %s.\n", num, error_string);
exit(EXIT_FAILURE);
}
+// LCOV_EXCL_STOP
/* end */