mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 16:48:06 +02:00
enh: resolve unit test and few other warnings.
This commit is contained in:
@@ -50,13 +50,11 @@ private:
|
||||
};
|
||||
|
||||
|
||||
inline Test::~Test()
|
||||
{
|
||||
}
|
||||
inline Test::~Test() = default;
|
||||
|
||||
|
||||
// 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*, const Callback&)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ class TestCaller: public TestCase
|
||||
{
|
||||
REFERENCEOBJECT (TestCaller)
|
||||
|
||||
typedef void (Fixture::*TestMethod)();
|
||||
using TestMethod = void (Fixture::*)();
|
||||
|
||||
public:
|
||||
TestCaller(const std::string& name, TestMethod test, Test::Type testType = Test::Normal):
|
||||
@@ -62,19 +62,19 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void runTest()
|
||||
void runTest() override
|
||||
{
|
||||
(_fixture.get()->*_test)();
|
||||
}
|
||||
|
||||
void setUp()
|
||||
void setUp() override
|
||||
{
|
||||
if (!setup().empty())
|
||||
_fixture.get()->addSetup(setup());
|
||||
_fixture.get()->setUp();
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
void tearDown() override
|
||||
{
|
||||
_fixture.get()->tearDown();
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "CppUnit/TestResult.h"
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <typeinfo>
|
||||
|
||||
@@ -88,14 +89,14 @@ class CppUnit_API TestCase: public Test
|
||||
REFERENCEOBJECT (TestCase)
|
||||
|
||||
public:
|
||||
TestCase(const std::string& Name, Test::Type testType = Test::Normal);
|
||||
~TestCase();
|
||||
TestCase(const std::string& name, Test::Type testType = Test::Normal);
|
||||
~TestCase() override;
|
||||
|
||||
virtual void run(TestResult* result, const Test::Callback& callback = nullptr);
|
||||
void run(TestResult* result, const Test::Callback& callback = nullptr) override;
|
||||
virtual TestResult* run();
|
||||
virtual int countTestCases() const;
|
||||
virtual std::string toString() const;
|
||||
virtual Test::Type getType() const;
|
||||
int countTestCases() const override;
|
||||
std::string toString() const override;
|
||||
Test::Type getType() const override;
|
||||
void setType(Test::Type testType);
|
||||
const std::string& name() const;
|
||||
|
||||
@@ -126,8 +127,8 @@ protected:
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
template <typename T1, typename T2,
|
||||
typename = typename std::enable_if<std::is_arithmetic<T1>::value, T1>::type,
|
||||
typename = typename std::enable_if<std::is_arithmetic<T2>::value, T2>::type>
|
||||
typename = std::enable_if_t<std::is_arithmetic_v<T1>, T1>,
|
||||
typename = std::enable_if_t<std::is_arithmetic_v<T2>, T2>>
|
||||
void assertEquals(T1 expected,
|
||||
T2 actual,
|
||||
long lineNumber = CppUnitException::CPPUNIT_UNKNOWNLINENUMBER,
|
||||
@@ -159,8 +160,8 @@ protected:
|
||||
const std::string& fileName = CppUnitException::CPPUNIT_UNKNOWNFILENAME);
|
||||
|
||||
template <typename T1, typename T2,
|
||||
typename = typename std::enable_if<std::is_arithmetic<T1>::value, T1>::type,
|
||||
typename = typename std::enable_if<std::is_arithmetic<T2>::value, T2>::type>
|
||||
typename = std::enable_if_t<std::is_arithmetic_v<T1>, T1>,
|
||||
typename = std::enable_if_t<std::is_arithmetic_v<T2>, T2>>
|
||||
std::string notEqualsMessage(T1 expected, T2 actual)
|
||||
{
|
||||
return "expected: " + std::to_string(expected) + " but was: " + std::to_string(actual);
|
||||
@@ -203,9 +204,7 @@ inline TestCase::TestCase(const std::string& name, Test::Type testType)
|
||||
|
||||
|
||||
// Destructs a test case
|
||||
inline TestCase::~TestCase()
|
||||
{
|
||||
}
|
||||
inline TestCase::~TestCase() = default;
|
||||
|
||||
|
||||
// Returns a count of all the tests executed
|
||||
@@ -229,7 +228,7 @@ inline void TestCase::setUp()
|
||||
|
||||
|
||||
// A hook for fixture set up with command line arguments
|
||||
inline void TestCase::setUp(const std::vector<std::string>& setup)
|
||||
inline void TestCase::setUp(const std::vector<std::string>&)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -31,13 +31,13 @@ class CppUnit_API TestDecorator: public Test
|
||||
public:
|
||||
TestDecorator(Test* test);
|
||||
|
||||
virtual ~TestDecorator();
|
||||
~TestDecorator() override;
|
||||
|
||||
int countTestCases() const;
|
||||
int countTestCases() const override;
|
||||
|
||||
void run(TestResult* result, const Test::Callback& callback = nullptr);
|
||||
void run(TestResult* result, const Test::Callback& callback = nullptr) override;
|
||||
|
||||
std::string toString() const;
|
||||
std::string toString() const override;
|
||||
|
||||
protected:
|
||||
Test* _test;
|
||||
|
@@ -64,13 +64,9 @@ public:
|
||||
class SynchronizationObject
|
||||
{
|
||||
public:
|
||||
SynchronizationObject()
|
||||
{
|
||||
}
|
||||
SynchronizationObject() = default;
|
||||
|
||||
virtual ~SynchronizationObject()
|
||||
{
|
||||
}
|
||||
virtual ~SynchronizationObject() = default;
|
||||
|
||||
virtual void lock()
|
||||
{
|
||||
@@ -138,7 +134,7 @@ inline void TestResult::addFailure(Test* test, CppUnitException* e)
|
||||
|
||||
|
||||
// Informs the result that a test will be started.
|
||||
inline void TestResult::startTest(Test* test)
|
||||
inline void TestResult::startTest(Test*)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
_runTests++;
|
||||
@@ -146,7 +142,7 @@ inline void TestResult::startTest(Test* test)
|
||||
|
||||
|
||||
// Informs the result that a test was completed.
|
||||
inline void TestResult::endTest(Test* test)
|
||||
inline void TestResult::endTest(Test*)
|
||||
{
|
||||
ExclusiveZone zone(_syncObject);
|
||||
}
|
||||
|
@@ -37,8 +37,8 @@ namespace CppUnit {
|
||||
*/
|
||||
class CppUnit_API TestRunner
|
||||
{
|
||||
typedef std::pair<std::string, Test*> Mapping;
|
||||
typedef std::vector<Mapping> Mappings;
|
||||
using Mapping = std::pair<std::string, Test *>;
|
||||
using Mappings = std::vector<Mapping>;
|
||||
|
||||
public:
|
||||
TestRunner();
|
||||
|
@@ -39,13 +39,13 @@ class CppUnit_API TestSuite: public Test
|
||||
|
||||
public:
|
||||
TestSuite(const std::string& name = "");
|
||||
~TestSuite();
|
||||
~TestSuite() override;
|
||||
|
||||
void run(TestResult* result, const Test::Callback& callback = nullptr);
|
||||
int countTestCases() const;
|
||||
void run(TestResult* result, const Test::Callback& callback = nullptr) override;
|
||||
int countTestCases() const override;
|
||||
void addTest(Test* test);
|
||||
std::string toString() const;
|
||||
Test::Type getType() const;
|
||||
std::string toString() const override;
|
||||
Test::Type getType() const override;
|
||||
|
||||
virtual void deleteContents();
|
||||
|
||||
|
@@ -24,9 +24,9 @@ public:
|
||||
TextTestResult(std::ostream& ostr);
|
||||
TextTestResult(std::ostream& ostr, const std::string& ignore);
|
||||
|
||||
virtual void addError(Test* test, CppUnitException* e);
|
||||
virtual void addFailure(Test* test, CppUnitException* e);
|
||||
virtual void startTest(Test* test);
|
||||
void addError(Test* test, CppUnitException* e) override;
|
||||
void addFailure(Test* test, CppUnitException* e) override;
|
||||
void startTest(Test* test) override;
|
||||
virtual void print(std::ostream& stream);
|
||||
virtual void printErrors(std::ostream& stream);
|
||||
virtual void printFailures(std::ostream& stream);
|
||||
|
Reference in New Issue
Block a user