From 056f7372b74594287d313eb4c987c0bce9038a5d Mon Sep 17 00:00:00 2001 From: Habib Date: Mon, 5 Feb 2024 19:51:28 +0100 Subject: [PATCH] =?UTF-8?q?i()=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 95bf9c5..c6062dc 100644 --- a/src/c/funktionen.c +++ b/src/c/funktionen.c @@ -81,4 +81,8 @@ int characterAppearanceInString(char c, char string[]) { } return appear; +} + +int i(int v, int r) { + return v / r; } \ No newline at end of file diff --git a/src/test/test_funktionen.c b/src/test/test_funktionen.c index 270e077..026caa6 100644 --- a/src/test/test_funktionen.c +++ b/src/test/test_funktionen.c @@ -152,4 +152,19 @@ void test_howManyTimes_e_appearsIn_Beere(void) TEST_ASSERT_EQUAL_INT(expected, actual); } +void test_current_at_voltage12_resistance6(void) +{ + /* arrange */ + int actual; + int expected = 2; + + /* act */ + int v = 12; + int r = 6; + actual = i(v, r); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} + #endif \ No newline at end of file