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.
71 lines
1.4 KiB
71 lines
1.4 KiB
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
#include "funktionen.h"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(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);
|
|
// Add more test cases for different inputs and expected outputs
|
|
}
|
|
|
|
#endif
|