|
|
@ -508,6 +508,40 @@ void test_lab_can_move_at_1_1_direction_N_target_WALL_expected_1(void) |
|
|
|
free(field); |
|
|
|
} |
|
|
|
|
|
|
|
void test_lab_can_move_at_1_1_direction_E_target_WALL_expected_1(void) |
|
|
|
{ |
|
|
|
/* arrange */ |
|
|
|
unsigned short x = 1; |
|
|
|
unsigned short y = 1; |
|
|
|
unsigned short x_target = 1; |
|
|
|
unsigned short y_target = 2; |
|
|
|
Direction direction = E; |
|
|
|
short expected = 1; |
|
|
|
short actual; |
|
|
|
|
|
|
|
unsigned short len_x = 3, len_y = 3; |
|
|
|
Field_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_target][y_target] = WALL; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
actual = lab_can_move(field, x, y, direction, len_x, len_y); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT8(expected, actual); |
|
|
|
|
|
|
|
for (int c_index = 0; c_index < len_x; c_index++) |
|
|
|
{ |
|
|
|
free(field[c_index]); |
|
|
|
} |
|
|
|
free(field); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|