|
@ -196,20 +196,14 @@ void test_validName(void) |
|
|
|
|
|
|
|
|
char* validNames[] = {"John","Jane","Fizz","Fooo","Atharva","Cahn","Julius","Haytham","Mohamed","Shivam"}; |
|
|
char* validNames[] = {"John","Jane","Fizz","Fooo","Atharva","Cahn","Julius","Haytham","Mohamed","Shivam"}; |
|
|
int minimalLength = 4; |
|
|
int minimalLength = 4; |
|
|
bool validNamesResult[10]; |
|
|
|
|
|
|
|
|
bool validNamesExpectation = true; |
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
|
|
|
{ |
|
|
|
|
|
validNamesResult[i] = isValidName(validNames[i],minimalLength); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
|
|
|
|
|
/*Act and Assert*/ |
|
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
for(int i = 0;i<10;i++) |
|
|
{ |
|
|
{ |
|
|
TEST_ASSERT_TRUE(validNamesResult[i]); |
|
|
|
|
|
|
|
|
bool validNamesResult = isValidName(validNames[i],minimalLength); |
|
|
|
|
|
TEST_ASSERT_EQUAL(validNamesExpectation,validNamesResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -220,20 +214,14 @@ void test_invalidName(void) |
|
|
|
|
|
|
|
|
char* invalidNames[] = {"Jo hn","Jane.","Fizz36","Foo8","Ath,arva","C .a1n","Jul.3ius","H613 aytham","Moh35gta.med","S-+h ivam"}; |
|
|
char* invalidNames[] = {"Jo hn","Jane.","Fizz36","Foo8","Ath,arva","C .a1n","Jul.3ius","H613 aytham","Moh35gta.med","S-+h ivam"}; |
|
|
int minimalLength = 4; |
|
|
int minimalLength = 4; |
|
|
bool invalidNamesResult[10]; |
|
|
|
|
|
|
|
|
bool invalidNamesExpectation = false; |
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
|
|
|
{ |
|
|
|
|
|
invalidNamesResult[i] = isValidName(invalidNames[i],minimalLength); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
|
|
|
|
|
/*Act and Assert*/ |
|
|
|
|
|
|
|
|
for(int i = 0;i<10;i++) |
|
|
for(int i = 0;i<10;i++) |
|
|
{ |
|
|
{ |
|
|
TEST_ASSERT_FALSE(invalidNamesResult[i]); |
|
|
|
|
|
|
|
|
bool invalidNamesResult = isValidName(invalidNames[i],minimalLength); |
|
|
|
|
|
TEST_ASSERT_EQUAL(invalidNamesExpectation,invalidNamesResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|