Skip to content

Commit

Permalink
T1437: Add --runall to Goldilocks 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeMouse92 committed Jan 30, 2021
1 parent 70cc8a9 commit 4cd45d6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pawlib-source/include/pawlib/goldilocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ class TestManager
* \return true if the item ran successfully, else false */
bool run(testname_t, unsigned int = 1);

/** Run all tests.
* \return true if the items ran successfully, else false */
bool runall();

/**Run a test by name.
* \param the name of the test to run
* \param the number of times to repeat the test
Expand Down
13 changes: 13 additions & 0 deletions pawlib-source/src/goldilocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,19 @@ bool TestManager::run(testname_t item, unsigned int number)
return false;
}

bool TestManager::runall()
{
/* Loop through all the indexes in the map `suites`...
* SOURCE: http://stackoverflow.com/a/110255/472647
*/
for(std::map<testsuitename_t, testsuiteptr_t>::iterator it = suites.begin(); it != suites.end(); ++it)
{
// Run each suite.
run_suite(it->first);
}
return true;
}

bool TestManager::run_suite(testsuitename_t suite)
{
/* ENTRY: Run a suite of tests.*/
Expand Down
10 changes: 10 additions & 0 deletions pawlib-source/src/goldilocks_shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ int GoldilocksShell::command(int argc_s, char* argv[], unsigned int skip)
// If run item succeeds, set the return code to 0, else 1 (error).
r = this->testmanager->run(tokens[++i]) ? 0 : 1;
}
// If runall flag is provided...
else if(tokens[i] == "--runall")
{
// Load all the suites first.
this->testmanager->load_suite();
loaded = true;

// If run item succeeds, set the return code to 0, else 1 (error).
r = this->testmanager->runall() ? 0 : 1;
}
// If benchmark flag and subsequent argument are provided...
else if(tokens[i] == "--benchmark")
{
Expand Down

0 comments on commit 4cd45d6

Please sign in to comment.