40 #ifndef _consolelogic_cpp
41 #define _consolelogic_cpp
52 #ifdef _MEZZ_THREAD_WIN32_
53 #ifndef WIN32_LEAN_AND_MEAN
54 #define WIN32_LEAN_AND_MEAN
55 #define __UNDEF_LEAN_AND_MEAN
58 #ifdef __UNDEF_LEAN_AND_MEAN
59 #undef WIN32_LEAN_AND_MEAN
60 #undef __UNDEF_LEAN_AND_MEAN
76 cout << std::endl <<
"Usage: " << ThisName <<
" [help] [summary] [testlist] [interactive|automatic] [all]\n\t[skipfile] Test Group Names ..." << std::endl << std::endl
77 <<
"All: All test groups will be run." << std::endl
78 <<
"Interactive: Only interactive tests will be performed on specified test groups." << std::endl
79 <<
"Automatic: Only automated tests will be performed on specified test groups." << std::endl
81 <<
"Summary: Only display a count of failures and successes." << std::endl
82 <<
"testlist: Output a list of all tests, one per line." << std::endl
83 <<
"skipfile: Do not store a copy of the results in TestResults.txt." << std::endl
84 <<
"debugtests: Run tests in the current process. Skips crash protection, but eases test debugging." << std::endl
85 <<
"Help: Display this message." << std::endl << std::endl
86 <<
"If only test group names are entered, then all tests in those groups are run." << std::endl
87 <<
"This command is not case sensitive." << std::endl << std::endl
88 <<
"Current Test Groups: " << std::endl;
91 for(std::map<Mezzanine::String,UnitTestGroup*>::iterator Iter=TestGroups.begin(); Iter!=TestGroups.end(); ++Iter)
93 if(Iter->first.size()>LongestName)
94 { LongestName=Iter->first.size();}
102 for(std::map<Mezzanine::String,UnitTestGroup*>::iterator Iter=TestGroups.begin(); Iter!=TestGroups.end(); ++Iter)
113 cout << Iter->second->Name() <<
" ";
114 CurrentWidth += Iter->first.size() + 1;
116 for(
Mezzanine::Whole SpaceD=Iter->first.size()+1; SpaceD<=ColumnWidth; SpaceD++)
122 if(CurrentWidth>TargetWidth-LongestName-1)
143 getline(std::cin, Input);
144 std::stringstream InputStream(Input);
145 if (InputStream >> Answer)
147 Answer=tolower(Answer);
148 if (Answer==
't' || Answer==
'y' || Answer==
'f' || Answer==
'n' || Answer==
'c' || Answer==
'u' || Answer==
'i')
152 cout << std::endl <<
"Expected (T)rue/(Y)es for Success, (F)alse/(N)o for Failure," << std::endl <<
" (C)anceled to cancel this test, or (U)nsure/(I)nconclusive if you don't know." << std::endl << std::endl;
160 if(FailStatusOnIncorrect)
175 Command +=
" > CommandResults.txt";
176 system(Command.c_str());
177 std::ifstream File(
"CommandResults.txt");
178 return String( std::istreambuf_iterator<char>(File), std::istreambuf_iterator<char>());
183 #if defined(_MEZZ_THREAD_WIN32_)
184 Sleep(MicroSeconds/1000);
186 usleep(MicroSeconds);
bool Boole
Generally acts a single bit, true or false.
Some string manipulation functions geared towards console output for use in the Unit Tests...
std::map< Mezzanine::String, UnitTestGroup * > CoreTestGroup
A group of testnames and the Actual test that implement those test(s).
At least some invalid args were passed on the command line.
int Usage(Mezzanine::String ThisName, CoreTestGroup &TestGroups)
Print a message for the user onf the standard output that briefly describes hwo to use this...
uint32_t UInt32
An 32-bit unsigned integer.
Since we don't know what happened this is the worst kind of failure.
Technically the test passed but there is something that is not quite right.
TestResult
Return values from tests.
String GetCommandResults(String Command)
Execute a command in a process, piping its standard output to a file.
If a user answers that with "don't know" in a test that involved interaction, The user knows there is...
The definition of a few command line tools.
The bulk of the engine components go in this namspace.
Was canceled by user, so success is unknown, but user knows test was canceled.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
TestResult GetTestAnswerFromStdin(Mezzanine::String Question, Boole FailStatusOnIncorrect)
Asked the user a question on the std output and get a TestResult as an answer.
Test was ran and appeared to work.
void sleep_for(UInt32 MicroSeconds)
Sleeps the current thread for an amount of microseconds.
std::string String
A datatype used to a series of characters.