Browse Source

Add test for currency change to GBP

remotes/origin/feature/currency-exchange
Shivam Chaudhary 2 years ago
parent
commit
ee420f6fb2
  1. 29
      tests/test_currencyExchange.c

29
tests/test_currencyExchange.c

@ -39,5 +39,34 @@ void test_toUSD(void) {
}
void test_toGBP(void) {
/* Arrange */
int length = 5;
float euro[] = {34, 233, 400, 100, 45};
float expectedGBP[length];
float resultGBP[length];
for (int i = 0; i < length; i++) {
resultGBP[i] = toGBP(euro[i]);
}
/* Act */
for (int i = 0; i < length; i++) {
expectedGBP[i] = euro[i] * CURRENT_GBP_RATE_OF_ONE_EURO;
}
/* Assert */
for (int i = 0; i < length; i++) {
TEST_ASSERT_EQUAL_FLOAT(expectedGBP[i], resultGBP[i]);
}
}
#endif // TEST
Loading…
Cancel
Save