diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index 6b12d145e..70659f906 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -475,6 +475,9 @@ namespace UserConfigParams &m_video_group, "Enable Exponential Shadow Map (better but slower)")); // ---- Debug - not saved to config file + /** If gamepad debugging is enabled. */ + PARAM_PREFIX bool m_unit_testing PARAM_DEFAULT(false); + /** If gamepad debugging is enabled. */ PARAM_PREFIX bool m_gamepad_debug PARAM_DEFAULT( false ); diff --git a/src/graphics/graphics_restrictions.cpp b/src/graphics/graphics_restrictions.cpp index fe999990c..9b10c293c 100644 --- a/src/graphics/graphics_restrictions.cpp +++ b/src/graphics/graphics_restrictions.cpp @@ -352,9 +352,9 @@ public: */ void unitTesting() { - assert(Version("1") == Version("1")); - assert(Version("1") != Version("2")); - assert(Version("1") <= Version("2")); + assert(Version("1") == Version("1")); + assert(Version("1") != Version("2")); + assert(Version("1") <= Version("2")); assert(Version("1") < Version("2")); assert(Version("1.2.3") < Version("2")); assert(Version("1.2.3") < Version("1.3")); diff --git a/src/main.cpp b/src/main.cpp index 546f3223b..c9e638731 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -657,7 +657,9 @@ int handleCmdLine() bool try_login = false; irr::core::stringw login, password; - if(CommandLine::has("--gamepad-debug")) + if (CommandLine::has("--unit-testing")) + UserConfigParams::m_unit_testing = true; + if (CommandLine::has("--gamepad-debug")) UserConfigParams::m_gamepad_debug=true; if (CommandLine::has("--keyboard-debug")) UserConfigParams::m_keyboard_debug = true; @@ -1286,10 +1288,11 @@ int main(int argc, char *argv[] ) } } -//#define UNIT_TEST -#ifdef UNIT_TEST - GraphicsRestrictions::unitTesting(); -#endif + if(UserConfigParams::m_unit_testing) + { + GraphicsRestrictions::unitTesting(); + exit(0); + } // Note that on the very first run of STK internet status is set to // "not asked", so the report will only be sent in the next run.