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.

45 lines
1.2 KiB

  1. #include "../src/arithmeticAddition.h"
  2. #include "unity.h"
  3. #include "limits.h"
  4. void setUp(void) {
  5. // set stuff up here
  6. }
  7. void tearDown(void) {
  8. // clean stuff up here
  9. }
  10. void test_arithmeticAddition_numberplusnumberequalsnumber(void) {
  11. int expectedResult = 8;
  12. int* result;
  13. result = addition_integer(5, 3);
  14. TEST_ASSERT_EQUAL_INT(expectedResult, *result);
  15. }
  16. void test_arithmeticAddition_numberplusmaxintegervalueequalsnull(void) {
  17. int* result;
  18. result = addition_integer(INT_MAX, 1);
  19. TEST_ASSERT_NULL(result);
  20. }
  21. void test_arithmeticAddition_doublenumbercalculationequalscorrectdoublenumber(void) {
  22. double expectedResult = 5.500000;
  23. double* result;
  24. result = addition_double(3.5, 2.0);
  25. TEST_ASSERT_EQUAL_DOUBLE(expectedResult, *result);
  26. }
  27. void test_arithmeticAddition_longnumbercalculationequalscorrectlong(void) {
  28. long expectedResult = 10;
  29. long* result;
  30. result = addition_long(5, 5);
  31. TEST_ASSERT_EQUAL_INT(expectedResult, *result);
  32. }
  33. void test_arithmeticAddition_floatnumbercalculationequalsfloat(void) {
  34. float expectedResult = 5.5;
  35. float* result;
  36. result = addition_float(3.5, 2.0);
  37. TEST_ASSERT_EQUAL_FLOAT(expectedResult, *result);
  38. }