Browse Source

refactoring: delete print statements from tests

master
fdai7848 11 months ago
parent
commit
f82b58b61a
  1. 27
      test/test_exponent.c

27
test/test_exponent.c

@ -31,10 +31,6 @@ void test_DoubleBase_ForNegativeExponent(void){
r2 = expIN(-3.0, -3.0); r2 = expIN(-3.0, -3.0);
r3 = expIN(-2.0, -2.0); r3 = expIN(-2.0, -2.0);
printf("Result 1: %f\n", r1);
printf("Result 2: %f\n", r2);
printf("Result 3: %f\n", r3);
TEST_ASSERT_EQUAL_FLOAT(0.5, r1); TEST_ASSERT_EQUAL_FLOAT(0.5, r1);
TEST_ASSERT_EQUAL_FLOAT(-0.0370370373, r2); TEST_ASSERT_EQUAL_FLOAT(-0.0370370373, r2);
TEST_ASSERT_EQUAL_FLOAT(0.25, r3); TEST_ASSERT_EQUAL_FLOAT(0.25, r3);
@ -47,10 +43,6 @@ void test_DoubleBase_for_positive_decimal_exponent(void){
r2 = expIN(0.5, 9.0); r2 = expIN(0.5, 9.0);
r3 = expIN(0.5, 2.0); r3 = expIN(0.5, 2.0);
printf("Result 1: %f\n", r1);
printf("Result 2: %f\n", r2);
printf("\nResult 3: %lf\n\n", r3);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.639474, r1); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.639474, r1);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 3.0, r2); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 3.0, r2);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.414213, r3); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.414213, r3);
@ -63,10 +55,6 @@ void test_DoubleDecimalBase_for_positive_decimal_exponent(void){
r2 = expIN(0.5, 3.13432); r2 = expIN(0.5, 3.13432);
r3 = expIN(0.124, 10.1231); r3 = expIN(0.124, 10.1231);
printf("Result 1: %f\n", r1);
printf("Result 2: %f\n", r2);
printf("\nResult 3: %lf\n\n", r3);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 0.760229, r1); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 0.760229, r1);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.770401, r2); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.770401, r2);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.332474, r3); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 1.332474, r3);
@ -79,10 +67,6 @@ void test_Exponent_with_positive_number(void){
r2 = exponential(1.0); r2 = exponential(1.0);
r3 = exponential(2.0); r3 = exponential(2.0);
printf("Result 1: %8.lf\n", r1);
printf("Result 2: %lf\n", r2);
printf("Result 3: %lf\n", r3);
TEST_ASSERT_EQUAL_DOUBLE(1.0, r1); TEST_ASSERT_EQUAL_DOUBLE(1.0, r1);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 2.718282, r2); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 2.718282, r2);
TEST_ASSERT_DOUBLE_WITHIN(0.0001, 7.389056, r3); TEST_ASSERT_DOUBLE_WITHIN(0.0001, 7.389056, r3);
@ -94,9 +78,6 @@ void test_Exponent_with_negative_number(void){
r1 = exponential(-1.0); r1 = exponential(-1.0);
r2 = exponential(-2.0); r2 = exponential(-2.0);
printf("Result 1: %lf\n", r1);
printf("Result 2: %lf\n", r2);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.367879, r1); TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.367879, r1);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.135335, r2); TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.135335, r2);
} }
@ -108,10 +89,6 @@ void test_ln_with_positive_number(void){
r2 = logN(10.0, 0.000001); r2 = logN(10.0, 0.000001);
r3 = logN(2.5, 0.000001); r3 = logN(2.5, 0.000001);
printf("Result 1: %lf\n", r1);
printf("Result 2: %lf\n", r2);
printf("Result 3: %lf\n", r3);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0, r1); TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0, r1);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 2.302585, r2); TEST_ASSERT_DOUBLE_WITHIN(0.000001, 2.302585, r2);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.916290, r3); TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.916290, r3);
@ -124,10 +101,6 @@ void test_ln_with_zero_and_negative_numbers(void){
r2 = logN(-1.0, 0.000001); r2 = logN(-1.0, 0.000001);
r3 = logN(-2.5, 0.000001); r3 = logN(-2.5, 0.000001);
printf("Result 1: %lf\n", r1);
printf("Result 2: %lf\n", r2);
printf("Result 3: %lf\n", r3);
TEST_ASSERT_EQUAL_DOUBLE(-1.0, r1); TEST_ASSERT_EQUAL_DOUBLE(-1.0, r1);
TEST_ASSERT_EQUAL_DOUBLE(-1.0, r2); TEST_ASSERT_EQUAL_DOUBLE(-1.0, r2);
TEST_ASSERT_EQUAL_DOUBLE(-1.0, r3); TEST_ASSERT_EQUAL_DOUBLE(-1.0, r3);

Loading…
Cancel
Save