|
@ -12,8 +12,12 @@ void tearDown(void) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void test_toUSD(void) { |
|
|
void test_toUSD(void) { |
|
|
|
|
|
|
|
|
|
|
|
/* Arrange */ |
|
|
|
|
|
|
|
|
int length = 5; |
|
|
int length = 5; |
|
|
float euro[] = {34, 233, 400, 100, 45}; |
|
|
float euro[] = {34, 233, 400, 100, 45}; |
|
|
|
|
|
|
|
|
float expectedUSD[length]; |
|
|
float expectedUSD[length]; |
|
|
float resultUSD[length]; |
|
|
float resultUSD[length]; |
|
|
|
|
|
|
|
@ -21,10 +25,14 @@ void test_toUSD(void) { |
|
|
resultUSD[i] = toUSD(euro[i]); |
|
|
resultUSD[i] = toUSD(euro[i]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Act */ |
|
|
|
|
|
|
|
|
for (int i = 0; i < length; i++) { |
|
|
for (int i = 0; i < length; i++) { |
|
|
expectedUSD[i] = euro[i] * CURRENT_USD_RATE_OF_ONE_EURO; |
|
|
expectedUSD[i] = euro[i] * CURRENT_USD_RATE_OF_ONE_EURO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Assert */ |
|
|
|
|
|
|
|
|
for (int i = 0; i < length; i++) { |
|
|
for (int i = 0; i < length; i++) { |
|
|
TEST_ASSERT_EQUAL_FLOAT(expectedUSD[i], resultUSD[i]); |
|
|
TEST_ASSERT_EQUAL_FLOAT(expectedUSD[i], resultUSD[i]); |
|
|
} |
|
|
} |
|
|