dodo
0.0.1
A C++ library to create containerized Linux services
|
Unit test assitence class. More...
#include <unittest.hpp>
Public Member Functions | |
UnitTest (const std::string &name, const std::string &description, std::ostream *out) | |
Create a test. More... | |
virtual | ~UnitTest () |
Destructor. More... | |
bool | run () |
Run the test. More... | |
Protected Member Functions | |
virtual void | doRun ()=0 |
Virtual to implement the test. More... | |
bool | writeSubTestResult (const std::string &name, const std::string &description, bool passed) |
Write the subtest result. More... | |
Private Member Functions | |
void | writeUnitTestHeader () |
Write the header. More... | |
void | writeUnitTestSummary () |
Write the summary. More... | |
Private Attributes | |
std::string | description_ |
The test description. More... | |
size_t | failed_ |
The total number of failed tests. More... | |
std::string | name_ |
The test name. More... | |
std::ostream * | out_ |
The output destination. More... | |
size_t | total_ |
The total number of tests. More... | |
Unit test assitence class.
Definition at line 34 of file unittest.hpp.
dodo::common::UnitTest::UnitTest | ( | const std::string & | name, |
const std::string & | description, | ||
std::ostream * | out | ||
) |
Create a test.
name | The name of the test. |
description | The description of the test. |
out | The ostream to write to. |
Definition at line 27 of file unittest.cpp.
|
inlinevirtual |
Destructor.
Definition at line 48 of file unittest.hpp.
|
protectedpure virtual |
bool dodo::common::UnitTest::run | ( | ) |
Run the test.
Definition at line 35 of file unittest.cpp.
References doRun(), failed_, writeUnitTestHeader(), and writeUnitTestSummary().
|
protected |
Write the subtest result.
name | The name of the test. |
description | The description of the test. |
passed | True if the test passed. |
Definition at line 55 of file unittest.cpp.
|
private |
Write the header.
Definition at line 42 of file unittest.cpp.
References description_, name_, and out_.
Referenced by run().
|
private |
|
private |
The test description.
Definition at line 84 of file unittest.hpp.
Referenced by writeUnitTestHeader().
|
private |
The total number of failed tests.
Definition at line 93 of file unittest.hpp.
Referenced by run(), writeSubTestResult(), and writeUnitTestSummary().
|
private |
|
private |
The output destination.
Definition at line 87 of file unittest.hpp.
Referenced by writeSubTestResult(), writeUnitTestHeader(), and writeUnitTestSummary().
|
private |
The total number of tests.
Definition at line 90 of file unittest.hpp.
Referenced by writeSubTestResult(), and writeUnitTestSummary().