Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6095: add a trivial test for the GameManager
This may not turn out to be all that useful, since the RadiantTest sets up a fake game by responding on the message bus, and never actually loads any .game files. Currently it is testing only that the game manager can return the expected config struct which reflects the fake game info populated by RadiantTest.
- Loading branch information
Matthew Mott
committed
Sep 13, 2022
1 parent
db43447
commit 9b05e8b
Showing
7 changed files
with
52 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "RadiantTest.h" | ||
#include "string/split.h" | ||
|
||
namespace test | ||
{ | ||
|
||
using GameTest = RadiantTest; | ||
|
||
TEST_F(GameTest, GetCurrentGameConfig) | ||
{ | ||
// Check that we can get the game manager and current game without crashing or anything | ||
auto& mgr = GlobalGameManager(); | ||
auto game = mgr.currentGame(); | ||
ASSERT_TRUE(game); | ||
|
||
// RadiantTest sets up a test game type which should be exposed via the GameManager | ||
auto conf = mgr.getConfig(); | ||
EXPECT_EQ(conf.gameType, RadiantTest::DEFAULT_GAME_TYPE); | ||
|
||
// The start of the engine path could be anywhere (depending on where the test binaries are | ||
// being run from), but it should end with "resources/tdm" | ||
auto pathComps = string::splitToVec(conf.enginePath, "/"); | ||
EXPECT_GE(pathComps.size(), 2); | ||
EXPECT_EQ(pathComps.at(pathComps.size() - 1), "tdm"); | ||
EXPECT_EQ(pathComps.at(pathComps.size() - 2), "resources"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters