diff --git a/src/c/map.c b/src/c/map.c index fef25b3..eb67707 100644 --- a/src/c/map.c +++ b/src/c/map.c @@ -62,3 +62,7 @@ Room *getMap(char *gameMapFile) int getRoomSuccessor(Room *room){ return room->successor; } + +void setRoomSuccessor(Room *room, int successorSet){ + room->successor = successorSet; +} diff --git a/src/c/map.h b/src/c/map.h index d91b417..e26284b 100644 --- a/src/c/map.h +++ b/src/c/map.h @@ -28,7 +28,7 @@ Room *getMap(char *gameMapFile); int getRoomSuccessor(Room *room); - +void setRoomSuccessor(Room *room, int successorSet); diff --git a/test/c/test_map.c b/test/c/test_map.c index 5db052e..337a247 100644 --- a/test/c/test_map.c +++ b/test/c/test_map.c @@ -63,6 +63,23 @@ void test_getRoomSuccessor(void) 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