|
|
@ -200,3 +200,34 @@ void test_lab_move_from_5_5_W_expected_5_4(void) |
|
|
|
TEST_ASSERT_TRUE(x == x_expected && y == y_expected); |
|
|
|
} |
|
|
|
|
|
|
|
void test_set_wall_at_0_0_expected_WALL(void) |
|
|
|
{ |
|
|
|
/* arrange */ |
|
|
|
unsigned short x = 0; |
|
|
|
unsigned short y = 0; |
|
|
|
|
|
|
|
unsigned short len_x = 1, len_y = 1; |
|
|
|
State **field; |
|
|
|
|
|
|
|
field = malloc(len_x * sizeof *field); |
|
|
|
for (int c_index = 0; c_index < len_x; c_index++){ |
|
|
|
field[c_index] = malloc(len_y * sizeof field[c_index]); |
|
|
|
} |
|
|
|
|
|
|
|
field[x][y] = WAY; |
|
|
|
|
|
|
|
State expected = WALL; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
set_wall(field, x, y); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_TRUE(field[x][y] == expected); |
|
|
|
|
|
|
|
for (int c_index = 0; c_index < len_x; c_index++) |
|
|
|
{ |
|
|
|
free(field[c_index]); |
|
|
|
} |
|
|
|
free(field); |
|
|
|
} |
|
|
|
|