Browse Source

refactoring: State --> Field_State

remotes/origin/Joe
Joe Lukas Kalb 11 months ago
parent
commit
d372b30160
  1. 2
      src/main/c/global.h
  2. 2
      src/main/c/labyrinth.c
  3. 2
      src/main/c/labyrinth.h
  4. 4
      src/test/c/test_labyrinth.c

2
src/main/c/global.h

@ -7,6 +7,6 @@ typedef enum {
typedef enum { typedef enum {
WAY, WALL, SOLUTION WAY, WALL, SOLUTION
} State;
} Field_State;
#endif #endif

2
src/main/c/labyrinth.c

@ -43,7 +43,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){
} }
void set_wall(State** field, unsigned short x, unsigned short y) {
void set_wall(Field_State** field, unsigned short x, unsigned short y) {
field[0][0] = WALL; field[0][0] = WALL;
} }

2
src/main/c/labyrinth.h

@ -5,6 +5,6 @@
void turn_direction_right(Direction *direction); void turn_direction_right(Direction *direction);
void lab_move(unsigned short *x, unsigned short *y, Direction direction); void lab_move(unsigned short *x, unsigned short *y, Direction direction);
void set_wall(State** field, unsigned short x, unsigned short y);
void set_wall(Field_State** field, unsigned short x, unsigned short y);
#endif // TEST_H #endif // TEST_H

4
src/test/c/test_labyrinth.c

@ -207,7 +207,7 @@ void test_set_wall_at_0_0_expected_WALL(void)
unsigned short y = 0; unsigned short y = 0;
unsigned short len_x = 1, len_y = 1; unsigned short len_x = 1, len_y = 1;
State **field;
Field_State **field;
field = malloc(len_x * sizeof *field); field = malloc(len_x * sizeof *field);
for (int c_index = 0; c_index < len_x; c_index++){ for (int c_index = 0; c_index < len_x; c_index++){
@ -216,7 +216,7 @@ void test_set_wall_at_0_0_expected_WALL(void)
field[x][y] = WAY; field[x][y] = WAY;
State expected = WALL;
Field_State expected = WALL;
/* act */ /* act */
set_wall(field, x, y); set_wall(field, x, y);

Loading…
Cancel
Save