|
@ -243,44 +243,48 @@ void test_validPhoneNumber(void) |
|
|
void test_isValidAdressSuccess(void) |
|
|
void test_isValidAdressSuccess(void) |
|
|
{ |
|
|
{ |
|
|
/*Arrange*/ |
|
|
/*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]; |
|
|
|
|
|
|
|
|
char* validCityAndStreet[][2] = { |
|
|
|
|
|
{"LeipzigerStrasse","Hannover"}, |
|
|
|
|
|
{"HannauerLandStra","Frankfurt"}, |
|
|
|
|
|
{"HenirichStrasse","Berlin"}, |
|
|
|
|
|
{"MAgdeburgerStrasse","Fulda"}}; |
|
|
|
|
|
|
|
|
|
|
|
int validHouseNumberAndPostalCode[][2] = { |
|
|
|
|
|
{112,36879}, |
|
|
|
|
|
{365,36897}, |
|
|
|
|
|
{16,12354}, |
|
|
|
|
|
{998,9999}}; |
|
|
|
|
|
bool expectation = true; |
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
|
/*Act and Assert*/ |
|
|
for(int i=0;i<4;i++) |
|
|
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]); |
|
|
|
|
|
|
|
|
bool validAdress = isValidAdress(validCityAndStreet[i][0],validCityAndStreet[i][1],validHouseNumberAndPostalCode[i][0],validHouseNumberAndPostalCode[i][1]); |
|
|
|
|
|
TEST_ASSERT_EQUAL(expectation,validAdress); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
void test_isValidAdressFailure(void) |
|
|
void test_isValidAdressFailure(void) |
|
|
{ |
|
|
{ |
|
|
/*Arrange*/ |
|
|
/*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]; |
|
|
|
|
|
|
|
|
char* invalidCityAndStreet[][2] = { |
|
|
|
|
|
{"LeipzigerStrassehvjhb","log"}, |
|
|
|
|
|
{"HannauerLandStranl","fiz"}, |
|
|
|
|
|
{"bob","foo"}, |
|
|
|
|
|
{"..","bar"}}; |
|
|
|
|
|
|
|
|
|
|
|
int invalidHouseNumberAndPostalCode[][2] = { |
|
|
|
|
|
{-10,-1}, |
|
|
|
|
|
{-1,10}, |
|
|
|
|
|
{0,999}, |
|
|
|
|
|
{99815,65}}; |
|
|
|
|
|
bool expectation = false; |
|
|
|
|
|
|
|
|
/*Act*/ |
|
|
|
|
|
|
|
|
/*Act and Assert*/ |
|
|
for(int i=0;i<4;i++) |
|
|
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]); |
|
|
|
|
|
|
|
|
bool invalidAdress = isValidAdress(invalidCityAndStreet[i][0],invalidCityAndStreet[i][1],invalidHouseNumberAndPostalCode[i][0],invalidHouseNumberAndPostalCode[i][1]); |
|
|
|
|
|
TEST_ASSERT_EQUAL(expectation,invalidAdress); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|