From b03bfd4d2085790f06db3dc9a1275c6a38267b27 Mon Sep 17 00:00:00 2001 From: Habib Date: Wed, 7 Feb 2024 16:55:02 +0100 Subject: [PATCH 1/2] =?UTF-8?q?f()=20definiert=20und=20einen=20Test=20f?= =?UTF-8?q?=C3=BCr=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 From a1ed8f5c307c36518006243fc2dab469cbc6ea42 Mon Sep 17 00:00:00 2001 From: Habib Date: Wed, 7 Feb 2024 16:55:35 +0100 Subject: [PATCH 2/2] =?UTF-8?q?f()=20in=20der=20Header-Datei=20deklariert?= =?UTF-8?q?=20und=20ihre=20Funktionalit=C3=A4t=20erkl=C3=A4rt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/funktionen.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/c/funktionen.h b/src/c/funktionen.h index 90cf1e5..b049937 100644 --- a/src/c/funktionen.h +++ b/src/c/funktionen.h @@ -58,4 +58,7 @@ int i(int v, int r); int p(int f, int a); // berechnet den Druck +float f(float m); +// berechnet die Gewichtkraft + #endif \ No newline at end of file