From b5af819bb7ca97276d1a89b1245a071ef8e9ee98 Mon Sep 17 00:00:00 2001 From: Aimee Reincke Date: Thu, 12 Jan 2023 11:52:16 +0100 Subject: [PATCH] refactoring: unittests naming improved --- src/c/rockPaperScissors.h | 6 +++--- test/c/test_rockPaperScissors.c | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/c/rockPaperScissors.h b/src/c/rockPaperScissors.h index cda1894..73dd319 100644 --- a/src/c/rockPaperScissors.h +++ b/src/c/rockPaperScissors.h @@ -8,9 +8,9 @@ enum inputOptions{ }; enum roundWinner{ - PLAYERWINSROUND = 'p', - COMPUTERWINSROUND = 'c', - NOWINNER = 'n' + PLAYERWINSROUND, + COMPUTERWINSROUND, + NOWINNER }; diff --git a/test/c/test_rockPaperScissors.c b/test/c/test_rockPaperScissors.c index 327b2d7..dea8ee4 100644 --- a/test/c/test_rockPaperScissors.c +++ b/test/c/test_rockPaperScissors.c @@ -17,7 +17,7 @@ void test_rockPaperScissors_sameResult(void) { /* arrange */ //Hier die Werte eingeben - char result; //p=player, c=computer, n=none + char result; int inputPlayer = ROCK; int inputComputer = inputPlayer; @@ -27,14 +27,14 @@ void test_rockPaperScissors_sameResult(void) /* assert */ //Vergleichen - TEST_ASSERT_EQUAL_INT('n', result); + TEST_ASSERT_EQUAL_INT(NOWINNER, result); } void test_rockPaperScissors_differentResultsPlayerWins(void) { /* arrange */ //Hier die Werte eingeben - char result; //p=player, c=computer, n=none + char result; int inputPlayer = ROCK; int inputComputer = SCISSORS; @@ -44,7 +44,7 @@ void test_rockPaperScissors_differentResultsPlayerWins(void) /* assert */ //Vergleichen - TEST_ASSERT_EQUAL_INT('p', result); + TEST_ASSERT_EQUAL_INT(PLAYERWINSROUND, result); /* arrange */ //Hier die Werte eingeben @@ -57,7 +57,7 @@ void test_rockPaperScissors_differentResultsPlayerWins(void) /* assert */ //Vergleichen - TEST_ASSERT_EQUAL_INT('p', result); + TEST_ASSERT_EQUAL_INT(PLAYERWINSROUND, result); /* arrange */ //Hier die Werte eingeben @@ -70,14 +70,14 @@ void test_rockPaperScissors_differentResultsPlayerWins(void) /* assert */ //Vergleichen - TEST_ASSERT_EQUAL_INT('p', result); + TEST_ASSERT_EQUAL_INT(PLAYERWINSROUND, result); } void test_rockPaperScissors_differentResultsPlayerLoses(void) { /* arrange */ //Hier die Werte eingeben - char result; //p=player, c=computer, n=none + char result; int inputPlayer = ROCK; int inputComputer = PAPER; @@ -87,7 +87,7 @@ void test_rockPaperScissors_differentResultsPlayerLoses(void) /* assert */ //Vergleichen - TEST_ASSERT_EQUAL_INT('c', result); + TEST_ASSERT_EQUAL_INT(COMPUTERWINSROUND, result); /* arrange */ //Hier die Werte eingeben @@ -100,7 +100,7 @@ void test_rockPaperScissors_differentResultsPlayerLoses(void) /* assert */ //Vergleichen - TEST_ASSERT_EQUAL_INT('c', result); + TEST_ASSERT_EQUAL_INT(COMPUTERWINSROUND, result); /* arrange */ //Hier die Werte eingeben @@ -113,7 +113,7 @@ void test_rockPaperScissors_differentResultsPlayerLoses(void) /* assert */ //Vergleichen - TEST_ASSERT_EQUAL_INT('c', result); + TEST_ASSERT_EQUAL_INT(COMPUTERWINSROUND, result); } #endif // TEST