From b03bfd4d2085790f06db3dc9a1275c6a38267b27 Mon Sep 17 00:00:00 2001 From: Habib Date: Wed, 7 Feb 2024 16:55:02 +0100 Subject: [PATCH] =?UTF-8?q?f()=20definiert=20und=20einen=20Test=20f=C3=BCr?= =?UTF-8?q?=20die=20Funktion=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/funktionen.c | 4 ++++ src/test/test_funktionen.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/c/funktionen.c b/src/c/funktionen.c index d6cb83d..ba2978e 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -119,4 +119,8 @@ int i(int v, int r) { int p(int f, int a) { return f / a; +} + +float f(float m) { + return m * 9.81; } \ No newline at end of file diff --git a/src/test/test_funktionen.c b/src/test/test_funktionen.c index e73a405..a03c572 100644 --- a/src/test/test_funktionen.c +++ b/src/test/test_funktionen.c @@ -257,4 +257,18 @@ void test_pressure_at_force360_area12(void) TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_weight_at_mass100(void) +{ + /* arrange */ + float actual; + float expected = 981; + + /* act */; + float m = 100; + actual = f(m); + + /* assert */ + TEST_ASSERT_EQUAL_FLOAT(expected, actual); +} + #endif \ No newline at end of file