Browse Source

Direction; change_direction N --> E

remotes/origin/Joe
Joe Lukas Kalb 11 months ago
parent
commit
414a018ea5
  1. 8
      src/main/c/global.h
  2. 14
      src/main/c/labyrinth.c
  3. 8
      src/main/c/labyrinth.h
  4. 6
      src/main/c/test.c
  5. 6
      src/main/c/test.h
  6. 0
      src/test/c/support/.invis
  7. 27
      src/test/c/test_labyrinth.c
  8. 28
      src/test/c/test_test.c

8
src/main/c/global.h

@ -0,0 +1,8 @@
#ifndef GLOBAL_H
#define GLOBAL_H
typedef enum {
N, E, S, W
} Dir;
#endif

14
src/main/c/labyrinth.c

@ -0,0 +1,14 @@
#include "labyrinth.h"
#include "global.h"
#include "stdio.h"
#include "stdlib.h"
void change_direction(Dir *direction){
switch (*direction) {
case N:
*direction = E;
break;
}
}

8
src/main/c/labyrinth.h

@ -0,0 +1,8 @@
#ifndef TEST_H
#define TEST_H
#include "global.h"
void change_direction(Dir *direction);
#endif // TEST_H

6
src/main/c/test.c

@ -1,6 +0,0 @@
#include "test.h"
int return_5(){
return 5;
}

6
src/main/c/test.h

@ -1,6 +0,0 @@
#ifndef TEST_H
#define TEST_H
int return_5();
#endif // TEST_H

0
src/test/c/support/.invis

27
src/test/c/test_labyrinth.c

@ -0,0 +1,27 @@
#include "unity.h"
#include "stdlib.h"
#include "labyrinth.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_change_direction_from_N_expected_E(void)
{
/* arrange */
Dir actual = N;
Dir expected = E;
/* act */
change_direction(&actual);
/* assert */
TEST_ASSERT_TRUE(expected == actual);
}

28
src/test/c/test_test.c

@ -1,28 +0,0 @@
#ifdef TEST
#include "unity.h"
#include "test.h"
void setUp(void)
{
}
void tearDown(void)
{
}
void test_test__return_5(void)
{
/* arrange */
int expected = 5;
int actual;
/* act */
actual = return_5();
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
}
#endif // TEST
Loading…
Cancel
Save