Added some kind of unit testing for version numbers in graphics

restrictions. It's only doing asserts for the tests :)  Use
--unit-testing command line switch.
This commit is contained in:
hiker 2015-01-08 10:05:19 +11:00
parent 1eb51db5ea
commit 526b38fc2a
3 changed files with 14 additions and 8 deletions

View File

@ -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 );

View File

@ -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"));

View File

@ -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.