|
@ -240,6 +240,50 @@ void test_validPhoneNumber(void) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_isValidAdressSuccess(void) |
|
|
|
|
|
{ |
|
|
|
|
|
/*Arrange*/ |
|
|
|
|
|
char* validStreet[] = {"LeipzigerStrasse","HannauerLandStra","HenirichStrasse","MAgdeburgerStrasse"}; |
|
|
|
|
|
char* validCity[] = {"Hannover","Frankfurt","Berlin","Fulda"}; |
|
|
|
|
|
int validHouseNumber[4] = {112,365,16,998}; |
|
|
|
|
|
int validPostalCode[4] = {36879,36897,12354,9999}; |
|
|
|
|
|
bool validAdress[4]; |
|
|
|
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
for(int i=0;i<4;i++) |
|
|
|
|
|
{ |
|
|
|
|
|
validAdress[i] = isValidAdress(validStreet[i],validCity[i],validHouseNumber[i],validPostalCode[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
|
|
for(int j=0;j<4;j++) |
|
|
|
|
|
{ |
|
|
|
|
|
TEST_ASSERT_TRUE(validAdress[j]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
void test_isValidAdressFailure(void) |
|
|
|
|
|
{ |
|
|
|
|
|
/*Arrange*/ |
|
|
|
|
|
char* invalidStreet[] = {"LeipzigerStrassehvjhb","HannauerLandStranl","bob",".."}; |
|
|
|
|
|
char* invalidCity[] = {"log","fiz","foo","bar"}; |
|
|
|
|
|
int invalidHouseNumber[4] = {-10,-1,0,99815}; |
|
|
|
|
|
int invalidPostalCode[4] = {-1,10,999,65}; |
|
|
|
|
|
bool invalidAdress[4]; |
|
|
|
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
for(int i=0;i<4;i++) |
|
|
|
|
|
{ |
|
|
|
|
|
invalidAdress[i] = isValidAdress(invalidStreet[i],invalidCity[i],invalidHouseNumber[i],invalidPostalCode[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*Assert*/ |
|
|
|
|
|
for(int j=0;j<4;j++) |
|
|
|
|
|
{ |
|
|
|
|
|
TEST_ASSERT_FALSE(invalidAdress[j]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
void test_invalidPhoneNumber(void) |
|
|
void test_invalidPhoneNumber(void) |
|
|
{ |
|
|
{ |
|
|
/*Arrange*/ |
|
|
/*Arrange*/ |
|
@ -255,4 +299,5 @@ void test_invalidPhoneNumber(void) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TEST |
|
|
#endif // TEST |