1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include <array>
- #include <map>
- #include <string>
- #include <vector>
- #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<std::string> client;
- std::vector<std::string> 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 {
- 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
|