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.

40 lines
752 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "logarithmus.h"
  4. #include "exponent.h"
  5. void setUp(void)
  6. {
  7. }
  8. void tearDown(void)
  9. {
  10. }
  11. void test_ln_with_positive_number(void){
  12. double r1, r2, r3;
  13. r1 = logN(1.0, 0.000001);
  14. r2 = logN(10.0, 0.000001);
  15. r3 = logN(2.5, 0.000001);
  16. TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0, r1);
  17. TEST_ASSERT_DOUBLE_WITHIN(0.000001, 2.302585, r2);
  18. TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.916290, r3);
  19. }
  20. void test_ln_with_zero_and_negative_numbers(void){
  21. double r1, r2, r3;
  22. r1 = logN(0.0, 0.000001);
  23. r2 = logN(-1.0, 0.000001);
  24. r3 = logN(-2.5, 0.000001);
  25. TEST_ASSERT_EQUAL_DOUBLE(-1.0, r1);
  26. TEST_ASSERT_EQUAL_DOUBLE(-1.0, r2);
  27. TEST_ASSERT_EQUAL_DOUBLE(-1.0, r3);
  28. }
  29. #endif // TEST