| 54 | }; |
| 55 | |
| 56 | BOOST_AUTO_TEST_CASE(test_Creatures) |
| 57 | { |
| 58 | LogManager logMgr; |
| 59 | logMgr.addSink(std::unique_ptr<LogSink>(new LogSinkConsole())); |
| 60 | std::vector<PlayerInfo> players; |
| 61 | |
| 62 | // We know we have seat id = 1, 2 |
| 63 | int seatId = 1; |
| 64 | // We know we have team id = 1, 2 |
| 65 | int32_t teamId = 1; |
| 66 | // The first player is the local one |
| 67 | for(uint32_t i = 0; i < 1; ++i) |
| 68 | { |
| 69 | PlayerInfo player; |
| 70 | player.mNick = "PlayerStub" + Helper::toString(seatId); |
| 71 | player.mWantedSeatId = seatId; |
| 72 | player.mWantedTeamId = teamId; |
| 73 | player.mIsHuman = true; |
| 74 | // The player id will be set by the server |
| 75 | player.mPlayerId = -1; |
| 76 | // We take faction index 0 for every player (keeper faction) |
| 77 | player.mWantedFactionIndex = 0; |
| 78 | players.push_back(player); |
| 79 | OD_LOG_INF("Adding player nick=" + player.mNick + ", id=" + Helper::toString(player.mPlayerId) + ", seatId=" + Helper::toString(player.mWantedSeatId)); |
| 80 | |
| 81 | ++seatId; |
| 82 | ++teamId; |
| 83 | } |
| 84 | |
| 85 | // We add the AI players |
| 86 | for(uint32_t i = 0; i < 2; ++i) |
| 87 | { |
| 88 | PlayerInfo playerAi; |
| 89 | playerAi.mPlayerId = 0; |
| 90 | playerAi.mWantedSeatId = seatId; |
| 91 | playerAi.mWantedTeamId = teamId; |
| 92 | playerAi.mWantedFactionIndex = 0; |
| 93 | playerAi.mIsHuman = false; |
| 94 | players.push_back(playerAi); |
| 95 | OD_LOG_INF("Adding ai player id=" + Helper::toString(playerAi.mPlayerId) + ", seatId=" + Helper::toString(playerAi.mWantedSeatId)); |
| 96 | |
| 97 | ++seatId; |
| 98 | ++teamId; |
| 99 | } |
| 100 | |
| 101 | uint32_t indexPlayer = 0; |
| 102 | if(indexPlayer >= players.size()) |
| 103 | { |
| 104 | BOOST_CHECK(false); |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | ODClientTestCreatures client(players, indexPlayer); |
| 109 | BOOST_CHECK(client.connect("localhost", 32222, 10, "test_CreaturesReplay")); |
| 110 | |
| 111 | BOOST_CHECK(client.isConnected()); |
| 112 | |
| 113 | // We run for 5s. Then, we will spawn some creatures |
nothing calls this directly
no test coverage detected