|
@ -0,0 +1,35 @@ |
|
|
|
|
|
#ifdef TEST |
|
|
|
|
|
|
|
|
|
|
|
#include "unity.h" |
|
|
|
|
|
#include "currencyExchange.h" |
|
|
|
|
|
|
|
|
|
|
|
void setUp(void) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void tearDown(void) |
|
|
|
|
|
{ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_toUSD(void) { |
|
|
|
|
|
int length = 5; |
|
|
|
|
|
float euro[] = {34, 233, 400, 100, 45}; |
|
|
|
|
|
float expectedUSD[length]; |
|
|
|
|
|
float resultUSD[length]; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < length; i++) { |
|
|
|
|
|
resultUSD[i] = toUSD(euro[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < length; i++) { |
|
|
|
|
|
expectedUSD[i] = euro[i] * CURRENT_USD_RATE_OF_ONE_EURO; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < length; i++) { |
|
|
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expectedUSD[i], resultUSD[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // TEST |