From b2ddfbafb329fdc2288a14cb914d047577b1c455 Mon Sep 17 00:00:00 2001 From: KaffeeMaus Date: Fri, 26 Jan 2024 12:08:38 +0100 Subject: [PATCH] add another horizontal player won test --- src/test/c/Georg/test_tictactoe.c | 33 ++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/test/c/Georg/test_tictactoe.c b/src/test/c/Georg/test_tictactoe.c index b8abc87..3cd7a56 100644 --- a/src/test/c/Georg/test_tictactoe.c +++ b/src/test/c/Georg/test_tictactoe.c @@ -231,4 +231,35 @@ void test_negativ_checkOnWin_horizontally(void){ TEST_ASSERT_EQUAL_INT( 0, result ); TEST_ASSERT_EQUAL_INT( 0, result2 ); TEST_ASSERT_EQUAL_INT( 0, result3 ); -} \ No newline at end of file +} + +void test_negativ_checkOnWin_horizontally2(void){ + // arrange + bool board1[3][3]={ + {1,1,0}, + {0,0,0}, + {0,0,0} + }; + + bool board2[3][3]={ + {0,0,0}, + {0,1,1}, + {0,0,0} + }; + + bool board3[3][3]={ + {0,0,0}, + {0,0,0}, + {1,0,1} + }; + + // act + bool result = playerHasWon( board1 ); + bool result2 = playerHasWon( board2 ); + bool result3 = playerHasWon( board3 ); + + // assert + TEST_ASSERT_EQUAL_INT( 0, result ); + TEST_ASSERT_EQUAL_INT( 0, result2 ); + TEST_ASSERT_EQUAL_INT( 0, result3 ); +}