From 6021ee8e0ab116e3a94923a7d1ea84fd28245a53 Mon Sep 17 00:00:00 2001 From: fdai7727 Date: Thu, 25 Jan 2024 18:59:29 +0100 Subject: [PATCH] =?UTF-8?q?refactoring:=20Einf=C3=BChren=20der=20konstante?= =?UTF-8?q?n=20Variablen=20scissor,=20rock,=20paper=20f=C3=BCr=20die=20Nut?= =?UTF-8?q?zung=20in=20den=20Tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/c/Tim/test_SchereSteinPapier.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/test/c/Tim/test_SchereSteinPapier.c b/src/test/c/Tim/test_SchereSteinPapier.c index 23e6143..485a07b 100644 --- a/src/test/c/Tim/test_SchereSteinPapier.c +++ b/src/test/c/Tim/test_SchereSteinPapier.c @@ -2,6 +2,10 @@ #include "unity.h" #include +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); }