Browse Source

lab_move direction S x --> 2

main^2
Joe Lukas Kalb 11 months ago
committed by Peter Wiebe
parent
commit
144b13919f
  1. 4
      src/main/c/labyrinth.c
  2. 17
      src/test/c/test_labyrinth.c

4
src/main/c/labyrinth.c

@ -32,6 +32,10 @@ void lab_move(unsigned short *x, unsigned short *y, Direction direction){
*y = *y + 1;
return;
}
if (direction == S){
*x = 2;
return;
}
}

17
src/test/c/test_labyrinth.c

@ -132,3 +132,20 @@ void test_lab_move_from_5_5_E_expected_5_6(void)
TEST_ASSERT_TRUE(x == x_expected && y == y_expected);
}
void test_lab_move_from_1_1_S_expected_2_1(void)
{
/* arrange */
unsigned short x = 1;
unsigned short y = 1;
Direction direction = S;
unsigned short x_expected = 2;
unsigned short y_expected = 1;
/* act */
lab_move(&x, &y, direction);
/* assert */
TEST_ASSERT_TRUE(x == x_expected && y == y_expected);
}
Loading…
Cancel
Save