Further code cleanups and documentation.

- Coverity defects.
- Documentation.
This commit is contained in:
2023-10-20 01:31:06 -07:00
parent 2a23d2e204
commit 4eb4008130
16 changed files with 254 additions and 99 deletions

View File

@@ -1,5 +1,5 @@
///
/// \file Test.h
/// \file Assert.h
/// \author K. Isom <kyle@imap.cc>
/// \date 2023-10-09
/// \brief Tooling to assist in building test programs..

View File

@@ -40,10 +40,15 @@ public:
/// \return The number of tests that failed.
size_t Failing() const;
/// \brief Returns the number of tests that have passed
/// successfully.
size_t Passing() const;
/// \brief Total is the number of tests registered.
size_t Total() const;
void Failed();
void Passed();
void AddTest(size_t testCount = 0);
void Reset(size_t testCount = 0);
@@ -54,8 +59,9 @@ public:
Report();
private:
size_t failing{};
size_t total{};
size_t failing;
size_t passed;
size_t total;
std::chrono::time_point<std::chrono::steady_clock> start;
std::chrono::time_point<std::chrono::steady_clock> end;

View File

@@ -41,6 +41,9 @@ struct UnitTest {
/// This is the test function to be run.
std::function<bool()> test;
/// This is the value the test returns if it passes.
bool expect;
};
/// \brief SimpleSuite is a test-running harness for simple tests.
@@ -105,8 +108,8 @@ public:
private:
bool quiet;
std::function<bool(void)> fnSetup, fnTeardown;
std::vector<UnitTest> tests;
std::function<bool(void)> fnSetup, fnTeardown;
std::vector<UnitTest> tests;
// Report functions.
Report report;