Browse Source

lab_move direction East y --> y + 1

remotes/origin/Joe
Joe Lukas Kalb 11 months ago
parent
commit
ccf6661ffd
  1. 2
      src/main/c/labyrinth.c
  2. 17
      src/test/c/test_labyrinth.c

2
src/main/c/labyrinth.c

@ -29,7 +29,7 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){
return;
}
if (direction == E){
*y = 2;
*y = *y + 1;
return;
}

17
src/test/c/test_labyrinth.c

@ -115,3 +115,20 @@ void test_lab_move_from_1_1_E_expected_1_2(void)
TEST_ASSERT_TRUE(x == x_expected && y == y_expected);
}
void test_lab_move_from_5_5_E_expected_5_6(void)
{
/* arrange */
unsigned short x = 5;
unsigned short y = 5;
Direction direction = E;
unsigned short x_expected = 5;
unsigned short y_expected = 6;
/* act */
lab_move(&x, &y, direction);
/* assert */
TEST_ASSERT_TRUE(x == x_expected && y == y_expected);
}
Loading…
Cancel
Save