fix(CppUint) : RepeatedTest compile error (#3759)

* chore(CppUnit) : style format and revise comment

fix(CppUnit) : RepeatedTest compile error

* chore(CppUnit) : remove TestResult forward declare in RepeatedTest.h
This commit is contained in:
haorui wang 2022-08-19 00:37:35 +08:00 committed by GitHub
parent c252b744f6
commit a41d802ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 11 deletions

View File

@ -10,14 +10,13 @@
#include "CppUnit/CppUnit.h"
#include "CppUnit/Guards.h"
#include "CppUnit/TestDecorator.h"
#include "CppUnit/TestResult.h"
namespace CppUnit {
class Test;
class TestResult;
/*
* A decorator that runs a test repeatedly.
@ -35,7 +34,7 @@ public:
int countTestCases();
std::string toString();
void run(TestResult *result);
void run(TestResult* result, const Test::Callback& callback = nullptr);
private:
const int _timesRepeat;
@ -43,7 +42,7 @@ private:
// Counts the number of test cases that will be run by this test.
inline RepeatedTest::countTestCases ()
inline int RepeatedTest::countTestCases()
{
return TestDecorator::countTestCases() * _timesRepeat;
}
@ -57,7 +56,7 @@ inline std::string RepeatedTest::toString()
// Runs a repeated test
inline void RepeatedTest::run(TestResult *result)
inline void RepeatedTest::run(TestResult *result, const Test::Callback& callback)
{
for (int n = 0; n < _timesRepeat; n++)
{

View File

@ -56,7 +56,7 @@ inline Test::~Test()
// Runs a test and collects its result in a TestResult instance.
inline void Test::run(TestResult *result, const Callback& callback)
inline void Test::run(TestResult* result, const Callback& callback)
{
}

View File

@ -42,7 +42,7 @@ namespace CppUnit {
* }
*
* You can use a TestCaller to bind any test method on a TestCase
* class, as long as it returns accepts void and returns void.
* class, as long as it accepts void and returns void.
*
* See TestCase
*/

View File

@ -35,7 +35,7 @@ public:
int countTestCases() const;
void run(TestResult* result, const Test::Callback& callback);
void run(TestResult* result, const Test::Callback& callback = nullptr);
std::string toString() const;

View File

@ -26,7 +26,7 @@ int TestDecorator::countTestCases() const
}
void TestDecorator::run(TestResult* result, const Test::Callback& callback = nullptr)
void TestDecorator::run(TestResult* result, const Test::Callback& callback)
{
_test->run(result);
}

View File

@ -23,7 +23,7 @@ void TestSuite::run(TestResult *result, const Test::Callback& callback)
{
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
{
if (result->shouldStop ())
if (result->shouldStop())
break;
Test *test = *it;
@ -39,7 +39,7 @@ int TestSuite::countTestCases() const
{
int count = 0;
for (std::vector<Test*>::const_iterator it = _tests.begin (); it != _tests.end (); ++it)
for (std::vector<Test*>::const_iterator it = _tests.begin(); it != _tests.end(); ++it)
count += (*it)->countTestCases();
return count;