From fdf0bcd9cafb8f6678bd5a5b5ca17cc0f5b18588 Mon Sep 17 00:00:00 2001 From: fdai7207 Date: Thu, 2 Feb 2023 03:01:53 +0100 Subject: [PATCH] refactoring: removed redundant code from the unit test of the employeeAccess() function. --- test/test_employeeLogin.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test/test_employeeLogin.c b/test/test_employeeLogin.c index e29bf5d..8860af5 100644 --- a/test/test_employeeLogin.c +++ b/test/test_employeeLogin.c @@ -132,21 +132,16 @@ void test_invalidEmployeeAccessCode(void) /*Arrange*/ char* invalidAccessCode[] = {"15","foo","fizz","buzz","fizzbuzz","test","bankmanagement"}; - bool invalidCodeResults[7]; + bool invalidCodeExpectation = false; - /*Act*/ + /*Act and assert*/ for(int i=0;i<7;i++) { - invalidCodeResults[i] = employeesAccess(invalidAccessCode[i]); + bool invalidCodeResults = employeesAccess(invalidAccessCode[i]); + TEST_ASSERT_EQUAL(invalidCodeExpectation,invalidCodeResults); } - /*Assert*/ - - for(int i=0;i<7;i++) - { - TEST_ASSERT_FALSE(invalidCodeResults[i]); - } } #endif // TEST