From fda57e8d0c4eae22a3d46f556edd028a97cad6ec Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 4 Feb 2024 20:34:45 +0100 Subject: [PATCH] absolute funktion test --- src/c/funktionen.h | 3 +++ src/test/test_funktionen.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/c/funktionen.h b/src/c/funktionen.h index 8377a0d..037ed94 100644 --- a/src/c/funktionen.h +++ b/src/c/funktionen.h @@ -13,4 +13,7 @@ float cube(float x); // Function to calculate the cube root of a number float cubeRoot(float x); +// Function to calculate the absolute value of a number +float absolute(float x); + #endif \ No newline at end of file diff --git a/src/test/test_funktionen.c b/src/test/test_funktionen.c index 26c8030..0f0b22c 100644 --- a/src/test/test_funktionen.c +++ b/src/test/test_funktionen.c @@ -32,4 +32,9 @@ void test_cubeRoot(void) { // Add more test cases for different inputs and expected outputs } +void test_absolute(void) { + float result = absolute(-5.0); + TEST_ASSERT_EQUAL_FLOAT(5.0, result); +} + #endif \ No newline at end of file