From bfc9a3741745edbbbea1cad3db968563211699a5 Mon Sep 17 00:00:00 2001 From: Habib Date: Tue, 6 Feb 2024 16:05:55 +0100 Subject: [PATCH] =?UTF-8?q?p()=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 | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/c/funktionen.c b/src/c/funktionen.c index c6062dc..4a4a52a 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -85,4 +85,8 @@ int characterAppearanceInString(char c, char string[]) { int i(int v, int r) { return v / r; +} + +int p(int f, int a) { + return f / a; } \ No newline at end of file diff --git a/src/test/test_funktionen.c b/src/test/test_funktionen.c index 026caa6..97ca0fa 100644 --- a/src/test/test_funktionen.c +++ b/src/test/test_funktionen.c @@ -167,4 +167,19 @@ void test_current_at_voltage12_resistance6(void) TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_pressure_at_force360_area12(void) +{ + /* arrange */ + int actual; + int expected = 30; + + /* act */ + int f = 360; + int a = 12; + actual = p(f, a); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif \ No newline at end of file