TEST(textGameLoopRoomPromptTest, textGameLoop){ Player myPlayer = Player("steve"); textGameLoop tGL = textGameLoop(&myPlayer); Room r = Room("test room", "a big spooky dungeon"); myPlayer.goTo(&r); CHECK_EQUAL("test room", myPlayer.pGetCurrentLocation()->getName()); r.addCommand("func1", tglFunc); r.addCommand("func2", tglFunc2); r.addCommand("func3", tglFunc3); //tGL.outputRoomPrompt(); //a big spooky dungeon //tGL.outputRoomCommands(); //func1\nfunc2\nfunc3\n };
TEST(textGameLoopInitTest, textGameLoop){ Player myPlayer = Player("steve"); textGameLoop tGL = textGameLoop(&myPlayer); Room r = Room("test room", "a big spooky dungeon"); myPlayer.goTo(&r); CHECK_EQUAL("test room", myPlayer.pGetCurrentLocation()->getName()); r.addCommand("func1", tglFunc); r.addCommand("func2", tglFunc2); r.addCommand("func3", tglFunc3); fptr command1pointer = myPlayer.pGetCurrentLocation()->getCommand("func1"); (*command1pointer)(); CHECK_EQUAL("tglFunc called.", tglFuncOutput); };
TEST(textGameLoopBeginTest, textGameLoop){ Player myPlayer = Player("steve"); textGameLoop tGL = textGameLoop(&myPlayer); Room r = Room("test room", "a big spooky dungeon"); tGL.addRoom(&r); tGL.movePlayer("test room"); CHECK_EQUAL("test room", myPlayer.pGetCurrentLocation()->getName()); r.addCommand("func1", tglFunc); r.addCommand("func2", tglFunc2); r.addCommand("func3", tglFunc3); fptr command1pointer; command1pointer = myPlayer.pGetCurrentLocation()->getCommand("func1"); tGL.begin(); };