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.

43 lines
643 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. /* Arrange */
  12. int length = 5;
  13. float euro[] = {34, 233, 400, 100, 45};
  14. float expectedUSD[length];
  15. float resultUSD[length];
  16. for (int i = 0; i < length; i++) {
  17. resultUSD[i] = toUSD(euro[i]);
  18. }
  19. /* Act */
  20. for (int i = 0; i < length; i++) {
  21. expectedUSD[i] = euro[i] * CURRENT_USD_RATE_OF_ONE_EURO;
  22. }
  23. /* Assert */
  24. for (int i = 0; i < length; i++) {
  25. TEST_ASSERT_EQUAL_FLOAT(expectedUSD[i], resultUSD[i]);
  26. }
  27. }
  28. #endif // TEST