|
|
@ -11,7 +11,88 @@ void tearDown(void) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
void test_1000_plus_1(void) |
|
|
|
void test_square(void) { |
|
|
|
float result = square(2.5); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(6.25, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_squareRoot(void) { |
|
|
|
float result = squareRoot(9.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(3.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_cube(void) { |
|
|
|
float result = cube(2.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(8.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_cubeRoot(void) { |
|
|
|
float result = cubeRoot(27.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(3.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_absolute(void) { |
|
|
|
float result = absolute(-5.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(5.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_logarithm(void) { |
|
|
|
float result = logarithm(100.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 2.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_naturalLogarithm(void) { |
|
|
|
float result = naturalLogarithm(100.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 4.60517, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_power(void) { |
|
|
|
float result = power(2.0, 3.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 8.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_factorial(void) { |
|
|
|
int result = factorial(5); |
|
|
|
TEST_ASSERT_EQUAL_INT(120, result); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_floorValue(void) { |
|
|
|
float result = floorValue(5.7); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(5.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_ceilingValue(void) { |
|
|
|
float result = ceilingValue(5.2); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(6.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_absoluteDifference(void) { |
|
|
|
float result = absoluteDifference(8.0, 4.5); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 3.5, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_maximum(void) { |
|
|
|
float result = maximum(5.0, 9.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 9.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_minimum(void) { |
|
|
|
float result = minimum(5.0, 9.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 5.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_average(void) { |
|
|
|
float result = average(5.0, 9.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 7.0, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_remainderValue(void) { |
|
|
|
float result = remainderValue(10.5, 3.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 1.5, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_500_plus_249_plus_251(void) |
|
|
|
{ |
|
|
|
/* arrange */ |
|
|
|
int actual; |
|
|
@ -182,4 +263,94 @@ void test_pressure_at_force360_area12(void) |
|
|
|
TEST_ASSERT_EQUAL_INT(expected, actual); |
|
|
|
} |
|
|
|
|
|
|
|
void test_sine(void) { |
|
|
|
float result = sine(0.5); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(0.479426, result); |
|
|
|
} |
|
|
|
|
|
|
|
void test_cosine(void) { |
|
|
|
float result = cosine(1.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(0.540302, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_tangent(void) { |
|
|
|
float result = tangent(1.5); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(14.101419, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_arcSine(void) { |
|
|
|
float result = arcSine(0.5); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(0.523599, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_arcCosine(void) { |
|
|
|
float result = arcCosine(0.5); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(1.047198, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_arcTangent(void) { |
|
|
|
float result = arcTangent(1.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(0.785398, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_degreesToRadians(void) { |
|
|
|
float result = degreesToRadians(90.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(1.570796, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_radiansToDegrees(void) { |
|
|
|
float result = radiansToDegrees(1.570796); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(90.0, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_logarithmPlusOne(void) { |
|
|
|
float result = logarithmPlusOne(10.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(2.0, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_naturalLogarithmPlusOne(void) { |
|
|
|
float result = naturalLogarithmPlusOne(10.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(3.302585, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void test_squareRootPlusOne(void) { |
|
|
|
float result = squareRootPlusOne(9.0); |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(4.0, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_cubeRootPlusOne(void) { |
|
|
|
float result = cubeRootPlusOne(8.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 3.0, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_sineDegrees(void) { |
|
|
|
float result = sineDegrees(45.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 0.7071068, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_cosineDegrees(void) { |
|
|
|
float result = cosineDegrees(60.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 0.5, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
void test_tangentDegrees(void) { |
|
|
|
float result = tangentDegrees(30.0); |
|
|
|
TEST_ASSERT_FLOAT_WITHIN(0.000001, 0.5773503, result); |
|
|
|
// Add more test cases for different inputs and expected outputs |
|
|
|
} |
|
|
|
|
|
|
|
#endif |