mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
Move tests from .h to .cpp
This commit is contained in:
parent
73ecef1a87
commit
509225f151
@ -141,18 +141,4 @@ struct Settings {
|
|||||||
void setConsoleInputAccessMapping(const ComposedKey& keyName, bool value);
|
void setConsoleInputAccessMapping(const ComposedKey& keyName, bool value);
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_CASE("settings get/set") {
|
|
||||||
Settings settings;
|
|
||||||
settings.set(Settings::General_Name, "hello, world");
|
|
||||||
CHECK_EQ(settings.getAsString(Settings::General_Name), "hello, world");
|
|
||||||
settings.set(Settings::General_Name, std::string("hello, world"));
|
|
||||||
CHECK_EQ(settings.getAsString(Settings::General_Name), "hello, world");
|
|
||||||
settings.set(Settings::General_MaxPlayers, 12);
|
|
||||||
CHECK_EQ(settings.getAsInt(Settings::General_MaxPlayers), 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("settings check for exception on wrong input type") {
|
|
||||||
Settings settings;
|
|
||||||
CHECK_THROWS(settings.set(Settings::General_Debug, "hello, world"));
|
|
||||||
CHECK_NOTHROW(settings.set(Settings::General_Debug, false));
|
|
||||||
}
|
|
||||||
|
@ -173,3 +173,19 @@ void Settings::setConsoleInputAccessMapping(const ComposedKey& keyName, bool val
|
|||||||
|
|
||||||
map->at(key) = value;
|
map->at(key) = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("settings get/set") {
|
||||||
|
Settings settings;
|
||||||
|
settings.set(Settings::General_Name, "hello, world");
|
||||||
|
CHECK_EQ(settings.getAsString(Settings::General_Name), "hello, world");
|
||||||
|
settings.set(Settings::General_Name, std::string("hello, world"));
|
||||||
|
CHECK_EQ(settings.getAsString(Settings::General_Name), "hello, world");
|
||||||
|
settings.set(Settings::General_MaxPlayers, 12);
|
||||||
|
CHECK_EQ(settings.getAsInt(Settings::General_MaxPlayers), 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("settings check for exception on wrong input type") {
|
||||||
|
Settings settings;
|
||||||
|
CHECK_THROWS(settings.set(Settings::General_Debug, "hello, world"));
|
||||||
|
CHECK_NOTHROW(settings.set(Settings::General_Debug, false));
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user