Test coverage: make LCOV ignore bug() and all calls to BUG()
In theory, these should be unreachable, so they shouldn't be covered with testing.
This commit is contained in:
parent
94aca03203
commit
6521d49c07
3 changed files with 14 additions and 12 deletions
|
@ -1138,7 +1138,7 @@ int action(FILE *input, struct command_t *command)
|
|||
case PART:
|
||||
return reservoir();
|
||||
default:
|
||||
BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST);
|
||||
BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
/* FALLTHRU */
|
||||
|
@ -1235,13 +1235,13 @@ int action(FILE *input, struct command_t *command)
|
|||
case PART:
|
||||
return reservoir();
|
||||
default:
|
||||
BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST);
|
||||
BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
|
||||
}
|
||||
case unknown:
|
||||
/* Unknown verb, couldn't deduce object - might need hint */
|
||||
rspeak(WHAT_DO, command->wd1, command->wd1x);
|
||||
return GO_CHECKHINT;
|
||||
default:
|
||||
BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN);
|
||||
BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
|
|
14
main.c
14
main.c
|
@ -250,7 +250,7 @@ static void checkhints(void)
|
|||
game.hintlc[hint] = 0;
|
||||
return;
|
||||
default:
|
||||
BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST);
|
||||
BUG(HINT_NUMBER_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ static bool playermove(token_t verb, int motion)
|
|||
int scratchloc, k2, kk = tkey[game.loc];
|
||||
game.newloc = game.loc;
|
||||
if (kk == 0)
|
||||
BUG(LOCATION_HAS_NO_TRAVEL_ENTRIES);
|
||||
BUG(LOCATION_HAS_NO_TRAVEL_ENTRIES); // LCOV_EXCL_LINE
|
||||
if (motion == NUL)
|
||||
return true;
|
||||
else if (motion == BACK) {
|
||||
|
@ -640,7 +640,7 @@ static bool playermove(token_t verb, int motion)
|
|||
break;
|
||||
do {
|
||||
if (travel[kk].stop)
|
||||
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
|
||||
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
|
||||
++kk;
|
||||
game.newloc = T_HIGH(travel[kk]);
|
||||
} while
|
||||
|
@ -681,7 +681,7 @@ static bool playermove(token_t verb, int motion)
|
|||
drop(EMERALD, game.loc);
|
||||
do {
|
||||
if (travel[kk].stop)
|
||||
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
|
||||
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
|
||||
++kk;
|
||||
game.newloc = T_HIGH(travel[kk]);
|
||||
} while
|
||||
|
@ -723,7 +723,7 @@ static bool playermove(token_t verb, int motion)
|
|||
return true;
|
||||
}
|
||||
default:
|
||||
BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST);
|
||||
BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
break; /* Leave L12 loop */
|
||||
|
@ -1113,7 +1113,7 @@ Lookup:
|
|||
rspeak(kmod);
|
||||
goto L2012;
|
||||
default:
|
||||
BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3);
|
||||
BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
Laction:
|
||||
|
@ -1150,7 +1150,7 @@ Laction:
|
|||
rspeak(DWARVES_AWAKEN);
|
||||
terminate(endgame);
|
||||
default:
|
||||
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH);
|
||||
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
6
misc.c
6
misc.c
|
@ -411,7 +411,7 @@ long vocab(long id, long init)
|
|||
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;
|
||||
|
@ -422,7 +422,7 @@ long vocab(long id, long init)
|
|||
return (lexeme);
|
||||
}
|
||||
}
|
||||
BUG(RAN_OFF_END_OF_VOCABULARY_TABLE);
|
||||
BUG(RAN_OFF_END_OF_VOCABULARY_TABLE); // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
void juggle(long object)
|
||||
|
@ -690,10 +690,12 @@ void datime(long* d, long* t)
|
|||
*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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue