#include #include #include #include #include "director.h" #include "galaxy.h" #include "gtest/gtest.h" /* How can I add logging, but not really add/use it? */ #define GTEST_COUT std::cerr << "[ ] [ INFO ]" namespace { TEST(director, director_debugging) { Director dir; std::vector client; std::vector server; dir.to_client = [&client](const std::string line) { client.push_back(line); }; dir.to_server = [&server](const std::string line) { server.push_back(line); }; dir.username = "test"; // should I setup galaxy-N-test.yaml ? Probably yes. std::string lines[] = { "TradeWars Game Server Copyright (C) " "EIS", "Selection (? for menu): N", "Trade Wars 2002 Win32 module now loading.", " ==-- Trade Wars 2002 --==", "Enter your choice: ", "^Command [TL=00:00:00]:[2985] (?=Help)? :"}; for (auto line : lines) { if (line[0] == '^') { dir.server_prompt(line.substr(1), line.substr(1)); } else if (line[0] == '!') { // client input dir.client_input(line.substr(1)); } else { dir.server_line(line, line); } } EXPECT_EQ(client[0], "\rTradeWars Proxy v2++ READY (~ or ESC to activate)\n\r"); client.clear(); dir.client_input("~"); for (auto line : client) { GTEST_COUT << line << std::endl; } } } // namespace