|
|
@ -190,4 +190,52 @@ void test_employeeCreatedSuccessfully(void) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void test_validName(void) |
|
|
|
{ |
|
|
|
/*Arrange*/ |
|
|
|
|
|
|
|
char* validNames[] = {"John","Jane","Fizz","Foo","Atharva","Can","Julius","Haytham","Mohamed","Shivam"}; |
|
|
|
int minimalLength = 4; |
|
|
|
bool validNamesResult[10]; |
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
|
{ |
|
|
|
validNamesResult[i] = isValidName(validNames[i],minimalLength); |
|
|
|
} |
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
|
{ |
|
|
|
TEST_ASSERT_TRUE(validNames[i]); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void test_invalidName(void) |
|
|
|
{ |
|
|
|
/*Arrange*/ |
|
|
|
|
|
|
|
char* invalidNames[] = {"Jo hn","Jane.","Fizz36","Foo8","Ath,arva","C .a1n","Jul132ius","123Haytham",".Mohamed"," Shivam"}; |
|
|
|
int minimalLength = 4; |
|
|
|
bool invalidNamesResult[10]; |
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
|
{ |
|
|
|
invalidNamesResult[i] = isValidName(invalidNames[i],minimalLength); |
|
|
|
} |
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
|
{ |
|
|
|
TEST_ASSERT_FALSE(invalidNamesResult[i]); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |