Browse Source

refactoring: Funktionsnamen verbessert

remotes/origin/habib
Habib 11 months ago
parent
commit
d5d63da06d
  1. 4
      src/c/funktionen.c
  2. 2
      src/c/funktionen.h
  3. 2
      src/test/test_funktionen.c

4
src/c/funktionen.c

@ -91,7 +91,7 @@ int x_wins_02_11_20(char board[][3]) {
} }
} }
int string_character_counter(char string[]) {
int stringCharacterCounter(char string[]) {
int stringLength = 0; int stringLength = 0;
for (int i = 0; string[i] != '\0'; i++) { for (int i = 0; string[i] != '\0'; i++) {
@ -104,7 +104,7 @@ int string_character_counter(char string[]) {
int characterAppearanceInString(char c, char string[]) { int characterAppearanceInString(char c, char string[]) {
int appear = 0; int appear = 0;
for (int i = 0; i < string_character_counter(string); i++) {
for (int i = 0; i < stringCharacterCounter(string); i++) {
if (string[i] == c) { if (string[i] == c) {
appear++; appear++;
} }

2
src/c/funktionen.h

@ -46,7 +46,7 @@ int x_wins_00_11_22(char board[][3]);
int x_wins_02_11_20(char board[][3]); int x_wins_02_11_20(char board[][3]);
// prüft, ob X bei Index 02, 11, 20 ist // prüft, ob X bei Index 02, 11, 20 ist
int string_character_counter(char string[]);
int stringCharacterCounter(char string[]);
// liefert die Länge eines Strings zurück // liefert die Länge eines Strings zurück
int characterAppearanceInString(char c, char string[]); int characterAppearanceInString(char c, char string[]);

2
src/test/test_funktionen.c

@ -205,7 +205,7 @@ void test_stringLaenge_von_Kokosnuss(void)
char string[] = "Kokosnuss"; char string[] = "Kokosnuss";
/* act */ /* act */
actual = string_character_counter(string);
actual = stringCharacterCounter(string);
/* assert */ /* assert */
TEST_ASSERT_EQUAL_INT(expected, actual); TEST_ASSERT_EQUAL_INT(expected, actual);

Loading…
Cancel
Save