Browse Source

Gegangenen weg makiert

remotes/origin/Labyrinth
Ronja Awe 2 years ago
parent
commit
4e0f06b273
  1. 3
      src/c/labyrinth.c
  2. 21
      test/c/test_labyrinth.c

3
src/c/labyrinth.c

@ -15,12 +15,15 @@ int printlabyrinth(lab laby, int hoehe, int breite){
}
printf("\n");
}
printf("\n");
return 0;
}
int wegsuchen(lab laby, int y, int x, int ziely, int zielx){
laby[y][x] = 'X';
if(x == zielx && y == ziely){
return 0;
}

21
test/c/test_labyrinth.c

@ -68,6 +68,27 @@ void test_LabyrinthAmZiel2(void){
TEST_ASSERT_EQUAL_INT(-1, result);
}
void test_LabyrinthMarkiert(void){
char result;
int input = 1;
int hoehe = 3;
int breite = 3;
lab laby = {
{'0', '1', '1'},
{'1', '1', '1'},
{'1', '1', '1'},
};
wegsuchen(laby, 0, 0, 0, 0);
result = laby[0][0];
printlabyrinth(laby, hoehe, breite);
TEST_ASSERT_EQUAL_CHAR('X', result);
}
#endif // TEST
Loading…
Cancel
Save