Browse Source

i() definiert und einen Test für die Funktion erstellt

remotes/origin/habib
Habib 11 months ago
parent
commit
056f7372b7
  1. 4
      src/c/funktionen.c
  2. 15
      src/test/test_funktionen.c

4
src/c/funktionen.c

@ -81,4 +81,8 @@ int characterAppearanceInString(char c, char string[]) {
} }
return appear; return appear;
}
int i(int v, int r) {
return v / r;
} }

15
src/test/test_funktionen.c

@ -152,4 +152,19 @@ void test_howManyTimes_e_appearsIn_Beere(void)
TEST_ASSERT_EQUAL_INT(expected, actual); 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 #endif
Loading…
Cancel
Save