Browse Source

8. Unittest

remotes/origin/Pascal
Pascal Schneider 11 months ago
parent
commit
44fa19385a
  1. 12
      test/test_timequiz.c

12
test/test_timequiz.c

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