Browse Source

If für noch nicht am Ziel erstellt

remotes/origin/Labyrinth
Ronja Awe 2 years ago
parent
commit
ecb3df3e5d
  1. 9
      src/c/labyrinth.c
  2. 18
      test/c/test_labyrinth.c

9
src/c/labyrinth.c

@ -21,6 +21,11 @@ return 0;
int wegsuchen(lab laby, int startx, int starty, int zielx, int ziely){ int wegsuchen(lab laby, int startx, int starty, int zielx, int ziely){
return 0;
if(startx == zielx && starty == ziely){
return 0;
}
else{
return -1;
}
} }

18
test/c/test_labyrinth.c

@ -50,6 +50,24 @@ void test_LabyrinthAmZiel(void){
TEST_ASSERT_EQUAL_INT(0, result); TEST_ASSERT_EQUAL_INT(0, result);
}
void test_LabyrinthAmZiel2(void){
int result;
int input = 1;
int hoehe = 3;
int breite = 3;
lab laby = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
};
result = wegsuchen(laby, 1, 1, 0, 0);
TEST_ASSERT_EQUAL_INT(-1, result);
} }
#endif // TEST #endif // TEST
Loading…
Cancel
Save