diff --git a/include/internal/TestCPPTestCase.h b/include/internal/TestCPPTestCase.h index da4698b..e425b53 100644 --- a/include/internal/TestCPPTestCase.h +++ b/include/internal/TestCPPTestCase.h @@ -289,7 +289,7 @@ namespace TestCPP { * @param out The stream to write the test failure reason to. * @param reason The test failure reason to write. */ - void logFailure (ostream& out, const string& reason); + void logFailure (ostream& out, const string& reason) const; /** * @brief If a test encounters an error while running, this * function will be called to log the test error. diff --git a/include/internal/TestCPPTestSuite.h b/include/internal/TestCPPTestSuite.h index 57780d2..fdfe4c3 100644 --- a/include/internal/TestCPPTestSuite.h +++ b/include/internal/TestCPPTestSuite.h @@ -145,7 +145,7 @@ namespace TestCPP { * @return The total number of tests that failed in the last * suite run. */ - unsigned getLastRunFailCount (); + unsigned getLastRunFailCount () const; /** * @brief Retrieve the total number of tests in the suite that @@ -153,7 +153,7 @@ namespace TestCPP { * @return The total number of tests that passed in the last * suite run. */ - unsigned getLastRunSuccessCount(); + unsigned getLastRunSuccessCount() const; /** * @brief Run all tests in the test suite. diff --git a/include/internal/TestCPPUtil.h b/include/internal/TestCPPUtil.h index 256c450..c869e5b 100644 --- a/include/internal/TestCPPUtil.h +++ b/include/internal/TestCPPUtil.h @@ -78,7 +78,7 @@ namespace TestCPP { * @return The name of the TestCPP object that this object * names. */ - const string& getName (); + const string& getName () const; /** * @brief Output the test object name to the specified stream. @@ -88,7 +88,7 @@ namespace TestCPP { */ friend std::ostream& operator<< ( std::ostream& s, - TestObjName& tcName + const TestObjName& tcName ); private: diff --git a/src/TestCPPTestCase.cpp b/src/TestCPPTestCase.cpp index 8c8bbf2..46e3c11 100644 --- a/src/TestCPPTestCase.cpp +++ b/src/TestCPPTestCase.cpp @@ -291,7 +291,7 @@ namespace TestCPP { return this->lastRunTime; } - void TestCase::logFailure(ostream& out, const string& reason) { + void TestCase::logFailure(ostream& out, const string& reason) const { out << fixed; out << setprecision(TCPPNum::TIME_PRECISION); out << TCPPStr::TEST << this->testName << TCPPStr::FAIL diff --git a/src/TestCPPTestSuite.cpp b/src/TestCPPTestSuite.cpp index cfd7f21..623e374 100644 --- a/src/TestCPPTestSuite.cpp +++ b/src/TestCPPTestSuite.cpp @@ -70,11 +70,11 @@ namespace TestCPP { this->suiteName = std::move(testSuiteName); } - unsigned TestSuite::getLastRunFailCount () { + unsigned TestSuite::getLastRunFailCount () const { return this->lastRunFailCount; } - unsigned TestSuite::getLastRunSuccessCount() { + unsigned TestSuite::getLastRunSuccessCount() const { return this->lastRunSuccessCount; } diff --git a/src/TestCPPUtil.cpp b/src/TestCPPUtil.cpp index 7d13eb1..ec8f887 100644 --- a/src/TestCPPUtil.cpp +++ b/src/TestCPPUtil.cpp @@ -56,13 +56,13 @@ namespace TestCPP { } } - const string& TestObjName::getName () { + const string& TestObjName::getName () const { return this->testCaseName; } std::ostream& operator<< ( std::ostream& s, - TestObjName& tcName + const TestObjName& tcName ) { s << tcName.getName();