Browse Source

refactoring: change_direction

main^2
Joe Lukas Kalb 11 months ago
committed by Peter Wiebe
parent
commit
4dff49735e
  1. 2
      src/main/c/global.h
  2. 2
      src/main/c/labyrinth.c
  3. 2
      src/main/c/labyrinth.h
  4. 6
      src/test/c/test_labyrinth.c

2
src/main/c/global.h

@ -3,6 +3,6 @@
typedef enum {
N, E, S, W
} Dir;
} Direction;
#endif

2
src/main/c/labyrinth.c

@ -5,7 +5,7 @@
#include "stdio.h"
#include "stdlib.h"
void change_direction(Dir *direction){
void turn_direction_right(Direction *direction){
switch (*direction) {
case N:
*direction = E;

2
src/main/c/labyrinth.h

@ -3,6 +3,6 @@
#include "global.h"
void change_direction(Dir *direction);
void turn_direction_right(Direction *direction);
#endif // TEST_H

6
src/test/c/test_labyrinth.c

@ -15,11 +15,11 @@ void tearDown(void)
void test_change_direction_from_N_expected_E(void)
{
/* arrange */
Dir actual = N;
Dir expected = E;
Direction actual = N;
Direction expected = E;
/* act */
change_direction(&actual);
turn_direction_right(&actual);
/* assert */
TEST_ASSERT_TRUE(expected == actual);

Loading…
Cancel
Save