|
|
@ -262,3 +262,33 @@ void test_set_wall_at_2_3_expected_WALL(void) |
|
|
|
free(field); |
|
|
|
} |
|
|
|
|
|
|
|
void test_init_field_at_0_0_expected_WAY(void) |
|
|
|
{ |
|
|
|
/* arrange */ |
|
|
|
unsigned short x = 0; |
|
|
|
unsigned short y = 0; |
|
|
|
|
|
|
|
unsigned short len_x = 1, len_y = 1; |
|
|
|
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][y] = WALL; |
|
|
|
|
|
|
|
Field_State expected = WAY; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
init_field(field, len_x, len_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); |
|
|
|
} |