diff --git a/src/main/c/main_calculator.c b/src/main/c/main_calculator.c index 76c9a10..8bfa480 100644 --- a/src/main/c/main_calculator.c +++ b/src/main/c/main_calculator.c @@ -300,7 +300,7 @@ double ConMeterToFoot(double distance, int startingUnit, int endingUnit) { break; case 1: //feet/inch to meter - return distance / 3. 28084; + return distance / 3.28084; break; default: @@ -311,7 +311,7 @@ double ConMeterToFoot(double distance, int startingUnit, int endingUnit) { switch (endingUnit) { case 0: //meter to feet/inch - return distance * 3. 28084; + return distance * 3.28084; break; case 1: //feet/inch to feet/inch @@ -338,7 +338,7 @@ double ConKilometerToMiles(double distance, int startingUnit, int endingUnit) { break; case 1: //miles to kilometer - return distance * 1. 60934; + return distance * 1.60934; break; default: @@ -349,7 +349,7 @@ double ConKilometerToMiles(double distance, int startingUnit, int endingUnit) { switch (endingUnit) { case 0: //kilometer to miles - return distance / 1. 60934; + return distance / 1.60934; break; case 1: //kilometer to kilometer @@ -804,7 +804,7 @@ double ConData(double data, int startingUnit, int endingUnit) { break; case 4: //1 - return; + return data; break; case 5: //0.001 @@ -964,7 +964,7 @@ double ConClock(double time, int startingUnit, int endingUnit) { } else { - return time + return time; } break; @@ -1105,7 +1105,7 @@ double ConTime(double time, int startingUnit, int endingUnit) { break; case 7: //y - return time / 60 * 24 * 7 * 4 * 12); + return time / (60 * 24 * 7 * 4 * 12); break; default: @@ -1296,7 +1296,7 @@ double ConTime(double time, int startingUnit, int endingUnit) { break; case 6: //mon - return time * 12); + return time * 12; break; case 7: //y diff --git a/src/test/c/test_calculator.c b/src/test/c/test_calculator.c index ea6b518..b3f261c 100644 --- a/src/test/c/test_calculator.c +++ b/src/test/c/test_calculator.c @@ -14,28 +14,28 @@ void tearDown(void) void test_addition(void) { - doulbe result = add(1, 2); + double result = add(1, 2); TEST_ASSERT_EQUAL(3, result); } void test_minus(void) { - doulbe result = minus(3, 1); + double result = minus(3, 1); TEST_ASSERT_EQUAL(2, result); } void test_multiply(void) { - doulbe result = multiply(1, 2); + double result = multiply(1, 2); TEST_ASSERT_EQUAL(2, result); } void test_divide(void) { - doulbe result = divide(4, 2); + double result = divide(4, 2); TEST_ASSERT_EQUAL(2, result); - doulbe result1 = divide(4, 0); + double result1 = divide(4, 0); TEST_ASSERT_EQUAL(0, result1); }