Browse Source

added setRoomSuccessor with test

remotes/origin/navigation
KRUGSON 2 years ago
parent
commit
ebbe703493
  1. 4
      src/c/map.c
  2. 2
      src/c/map.h
  3. 17
      test/c/test_map.c

4
src/c/map.c

@ -62,3 +62,7 @@ Room *getMap(char *gameMapFile)
int getRoomSuccessor(Room *room){ int getRoomSuccessor(Room *room){
return room->successor; return room->successor;
} }
void setRoomSuccessor(Room *room, int successorSet){
room->successor = successorSet;
}

2
src/c/map.h

@ -28,7 +28,7 @@ Room *getMap(char *gameMapFile);
int getRoomSuccessor(Room *room); int getRoomSuccessor(Room *room);
void setRoomSuccessor(Room *room, int successorSet);

17
test/c/test_map.c

@ -63,6 +63,23 @@ void test_getRoomSuccessor(void)
TEST_ASSERT_EQUAL(successor, result); TEST_ASSERT_EQUAL(successor, result);
} }
void test_setRoomSuccessor(void)
{
// arrange
int successor = 2, result;
// act
Room test;
setRoomSuccessor(&test, successor);
result = test.successor;
//output
printf("setRoomSuccessor | successor to set: %d -> is: %d", successor, result);
// assert
TEST_ASSERT_EQUAL(successor, result);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save