Browse Source

refactoring: removed redundant code from the unit tests of the function isValidPassword().

remotes/origin/feature/employees-infos-access
fdai7207 2 years ago
parent
commit
1dc001b251
  1. 22
      tests/test_createEmployeeAccount.c

22
tests/test_createEmployeeAccount.c

@ -55,20 +55,15 @@ void test_validEmployeePassword(void)
char* validPassword [] = {"Atharva.123","02.September.2023","fdai7207.","array[20]","malloc(20*sizeof(int))","12.2E1234"};
int minimalLength = 8;
bool validPasswordexpectation = true;
bool validPasswordResult[6];
/*Act*/
/*Act and Assert*/
for(int i=0; i<6; i++)
{
validPasswordResult[i] = isValidPassword(validPassword[i],minimalLength);
}
/*Assert*/
for(int i=0; i<6; i++)
{
TEST_ASSERT_TRUE(validPasswordResult[i]);
TEST_ASSERT_EQUAL(validPasswordexpectation,validPasswordResult[i]);
}
}
@ -79,20 +74,15 @@ void test_invalidEmployeePassword(void)
char* invalidPassword [] = {"fizzbuzzio","02.09.2023",".^^_*+/-.","RTX4050ti","Can","github.com/bankmanagement-system"};
int minimalLength = 8;
bool invalidPasswordexpected = false;
bool invalidPasswordResult[6];
/*Act*/
/*Act and Assert*/
for(int i=0; i<6; i++)
{
invalidPasswordResult[i] = isValidPassword(invalidPassword[i],minimalLength);
}
/*Assert*/
for(int i=0; i<6; i++)
{
TEST_ASSERT_FALSE(invalidPasswordResult[i]);
TEST_ASSERT_EQUAL(invalidPasswordexpected,invalidPasswordResult[i]);
}
}

Loading…
Cancel
Save