Browse Source

7. Unittest

remotes/origin/Pascal
Pascal Schneider 11 months ago
parent
commit
3bd89c3243
  1. 11
      test/test_timequiz.c

11
test/test_timequiz.c

@ -86,4 +86,15 @@ void test_processUserAnswer_correctAnswer_index0(void) {
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers);
} }
void test_processUserAnswer_wrongAnswer_index3(void) {
int score = 0;
int totalCorrectAnswers = 0;
char* answers[] = {"Paris", "London", "Berlin", "Madrid"};
int correctIndex = 0;
int userAnswer = 4; // Assuming user selects the fourth option
processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers);
TEST_ASSERT_EQUAL_INT(0, score);
TEST_ASSERT_EQUAL_INT(0, totalCorrectAnswers);
}
#endif //TEST #endif //TEST
Loading…
Cancel
Save