Browse Source

Implementation der Tests für den Testfall 'Verloren' + Korrektur im Produktivcode bei der Ergebnisberechnung

remotes/origin/tim
fdai7727 11 months ago
parent
commit
bc7ba1d0a6
  1. 4
      src/main/c/Tim/SchereSteinPapier.c
  2. 27
      src/test/c/Tim/test_SchereSteinPapier.c

4
src/main/c/Tim/SchereSteinPapier.c

@ -70,9 +70,9 @@ int calculateWinner(int x, int y)
}
case(3):
switch (y) {
case(1): return 1;
case(1): return -1;
case(2): return -1;
case(2): return 1;
case(3): return 0;

27
src/test/c/Tim/test_SchereSteinPapier.c

@ -35,5 +35,32 @@ void test_drawPaperPaper()
int actualResult = calculateWinner(3,3);
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
void test_lose_USER_Scissor_COM_Rock()
{
int expectedResult = -1;
int actualResult = calculateWinner(1,2);
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
void test_lose_USER_Paper_COM_Scissor()
{
int expectedResult = -1;
int actualResult = calculateWinner(3,1);
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
void test_lose_USER_Rock_COM_Paper()
{
int expectedResult = -1;
int actualResult = calculateWinner(2,3);
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
Loading…
Cancel
Save