Browse Source

refactoring: Einführen der konstanten Variablen scissor, rock, paper für die Nutzung in den Tests

remotes/origin/tim
fdai7727 11 months ago
parent
commit
6021ee8e0a
  1. 22
      src/test/c/Tim/test_SchereSteinPapier.c

22
src/test/c/Tim/test_SchereSteinPapier.c

@ -2,6 +2,10 @@
#include "unity.h"
#include <stdlib.h>
const int scissor = 1;
const int rock = 2;
const int paper = 3;
void setUp(void)
{
@ -19,7 +23,7 @@ void test_draw_USER_Scissor_COM_Scissor()
//arrange
int expectedResult = 0;
//act
int actualResult = calculateWinner(1,1);
int actualResult = calculateWinner(scissor,scissor);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -29,7 +33,7 @@ void test_draw_USER_Rock_COM_Rock()
//arrange
int expectedResult = 0;
//act
int actualResult = calculateWinner(2,2);
int actualResult = calculateWinner(rock,rock);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -39,7 +43,7 @@ void test_draw_USER_Paper_COM_Paper()
//arrange
int expectedResult = 0;
//act
int actualResult = calculateWinner(3,3);
int actualResult = calculateWinner(paper,paper);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -52,7 +56,7 @@ void test_lose_USER_Scissor_COM_Rock()
//arrange
int expectedResult = -1;
//act
int actualResult = calculateWinner(1,2);
int actualResult = calculateWinner(scissor,rock);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -62,7 +66,7 @@ void test_lose_USER_Paper_COM_Scissor()
//arrange
int expectedResult = -1;
//act
int actualResult = calculateWinner(3,1);
int actualResult = calculateWinner(paper,scissor);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -72,7 +76,7 @@ void test_lose_USER_Rock_COM_Paper()
//arrange
int expectedResult = -1;
//act
int actualResult = calculateWinner(2,3);
int actualResult = calculateWinner(rock,paper);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -85,7 +89,7 @@ void test_win_USER_Scissor_COM_Paper()
//arrange
int expectedResult = 1;
//act
int actualResult = calculateWinner(1,3);
int actualResult = calculateWinner(scissor,paper);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -95,7 +99,7 @@ void test_win_USER_Rock_COM_Scissor()
//arrange
int expectedResult = 1;
//act
int actualResult = calculateWinner(2,1);
int actualResult = calculateWinner(rock,scissor);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}
@ -105,7 +109,7 @@ void test_win_USER_Paper_COM_Rock()
//arrange
int expectedResult = 1;
//act
int actualResult = calculateWinner(3,2);
int actualResult = calculateWinner(paper,rock);
//assert
TEST_ASSERT_EQUAL_INT(expectedResult, actualResult);
}

Loading…
Cancel
Save