#include <vector>
#include <list>
#include <set>
+#include <map>
namespace DPL
{
{
class TestRunner
{
- TestResultsCollectorBasePtr m_collector;
- std::string m_collectorName;
+ typedef std::map<std::string, TestResultsCollectorBasePtr>
+ TestResultsCollectors;
+ TestResultsCollectors m_collectors;
+
std::string m_startTestId;
+ bool m_runIgnored;
public:
typedef void (*TestCase)();
DPL::Atomic m_totalAssertions;
void Banner();
- void InvalidArgs();
+ void InvalidArgs(const std::string& message = "Invalid arguments!");
void Usage();
- enum Status { FAILED, TODO, IGNORED, PASS };
+ enum Status { FAILED, IGNORED, PASS };
Status RunTestCase(const TestCaseStruct& testCase);
void RunTests();
+ void CollectResult(const std::string& id,
+ const std::string& description,
+ const TestResultsCollectorBase::FailStatus::Type status
+ = TestResultsCollectorBase::FailStatus::NONE,
+ const std::string& reason = std::string());
+
public:
class TestFailed
{
}
};
- class ToDo
- {
- private:
- std::string m_message;
-
- public:
- ToDo()
- {
- }
-
- ToDo(const std::string &message)
- : m_message(message)
- {
- }
-
- std::string GetMessage() const
- {
- return m_message;
- }
- };
-
class Ignored
{
private:
int ExecTestRunner(int argc, char *argv[]);
typedef std::vector<std::string> ArgsList;
int ExecTestRunner(const ArgsList& args);
+ bool getRunIgnored() const;
};
typedef DPL::Singleton<TestRunner> TestRunnerSingleton;
#define RUNNER_FAIL RUNNER_ASSERT(false)
-#define RUNNER_TODO_MSG(message) do { std::ostringstream assertMsg; assertMsg << message; throw DPL::Test::TestRunner::ToDo(assertMsg.str()); } while (0)
-
#define RUNNER_IGNORED_MSG(message) do { std::ostringstream assertMsg; assertMsg << message; throw DPL::Test::TestRunner::Ignored(assertMsg.str()); } while (0)
#endif // DPL_TEST_RUNNER_H