New unit_test framework:

* Header-only!
* No external dependencies or other beast modules
* Compilation options allow for:
  - Stand-alone application to run a single test suite
  - Stand-alone application to run a set of test suites
  - Global suite of tests inline with the host application
  - Disable test suite generation completely
* Existing tests reworked to use the new classes
This commit is contained in:
Vinnie Falco
2014-03-20 17:25:39 -07:00
parent 0bb6171a85
commit f63cf33118
114 changed files with 3259 additions and 4312 deletions

View File

@@ -65,11 +65,14 @@ String PeerTest::Result::message () const noexcept
return m_message;
}
bool PeerTest::Result::report (UnitTest& test, bool reportPassingTests) const
bool PeerTest::Result::report (unit_test::suite& suite,
bool reportPassingTests) const
{
bool const success = test.unexpected (failed (), message ());
bool const success = suite.expect (! failed (),
message ().toStdString());
if (reportPassingTests && success)
test.logMessage (String ("pass ") + message());
suite.log <<
"pass " + message().toStdString();
return success;
}
@@ -90,14 +93,15 @@ bool PeerTest::Results::operator!= (Results const& other) const noexcept
return (client != other.client) || (server != other.server);
}
bool PeerTest::Results::report (UnitTest& test, bool beginTestCase) const
bool PeerTest::Results::report (unit_test::suite& suite,
bool beginTestCase) const
{
if (beginTestCase)
test.beginTestCase (name);
suite.testcase (name.toStdString());
bool success = true;
if (! client.report (test))
if (! client.report (suite))
success = false;
if (! server.report (test))
if (! server.report (suite))
success = false;
return success;
}