diff --git a/src/c/map.c b/src/c/map.c index 5e0c8c4..1221b8f 100644 --- a/src/c/map.c +++ b/src/c/map.c @@ -78,3 +78,13 @@ void setRoomPredecessor(Room *room, int predecessorSet) { room->predecessor = predecessorSet; } + +bool getRoomShopAvailable(Room *room) +{ + return room->shopAvailable; +} + +void setRoomShopAvailable(Room *room, bool shopAvailableSet) +{ + room->shopAvailable = shopAvailableSet; +} \ No newline at end of file diff --git a/src/c/map.h b/src/c/map.h index 966a89c..1cff482 100644 --- a/src/c/map.h +++ b/src/c/map.h @@ -33,4 +33,7 @@ void setRoomSuccessor(Room *room, int successorSet); int getRoomPredecessor(Room *room); void setRoomPredecessor(Room *room, int predecessorSet); +bool getRoomShopAvailable(Room *room); +void setRoomShopAvailable(Room *room, bool shopAvailableSet); + #endif // MAP_H \ No newline at end of file diff --git a/test/c/test_map.c b/test/c/test_map.c index 9cb774f..fce9775 100644 --- a/test/c/test_map.c +++ b/test/c/test_map.c @@ -115,5 +115,39 @@ void test_setRoomPredecessor(void) TEST_ASSERT_EQUAL(predecessor, result); } +void test_getRoomShopAvailable(void) +{ + // arrange + bool available = true, result; + Room test; + test.shopAvailable = available; + + /* act */ + // Die Funktion wird ausgeführt + result = getRoomShopAvailable(&test); + + // output + printf("getRoomShopAvailable | shopAvailable should be: %d -> is: %d", available, result); + + // assert + TEST_ASSERT_EQUAL(available, result); +} + +void test_setRoomShopAvailable(void) +{ + // arrange + bool available = true, result; + + // act + Room test; + setRoomShopAvailable(&test, available); + result = test.shopAvailable; + + //output + printf("setRoomShopAvailable | shopAvailable set to: %d -> after set: %d", available, result); + + // assert + TEST_ASSERT_EQUAL(available, result); +} #endif // TEST