You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
583 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "currencyExchange.h"
  4. void setUp(void)
  5. {
  6. }
  7. void tearDown(void)
  8. {
  9. }
  10. void test_toUSD(void) {
  11. int length = 5;
  12. float euro[] = {34, 233, 400, 100, 45};
  13. float expectedUSD[length];
  14. float resultUSD[length];
  15. for (int i = 0; i < length; i++) {
  16. resultUSD[i] = toUSD(euro[i]);
  17. }
  18. for (int i = 0; i < length; i++) {
  19. expectedUSD[i] = euro[i] * CURRENT_USD_RATE_OF_ONE_EURO;
  20. }
  21. for (int i = 0; i < length; i++) {
  22. TEST_ASSERT_EQUAL_FLOAT(expectedUSD[i], resultUSD[i]);
  23. }
  24. }
  25. #endif // TEST