mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
enh: resolve unit test and few other warnings.
This commit is contained in:
parent
065f9a0ff9
commit
ad72b25ace
@ -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);
|
||||
|
@ -62,10 +62,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Pair()
|
||||
virtual ~Pair() = default;
|
||||
/// Destroys the Pair.
|
||||
{
|
||||
}
|
||||
|
||||
Pair& swap(Pair& other) noexcept
|
||||
/// Swaps the content of the two Pairs.
|
||||
@ -122,62 +120,62 @@ public:
|
||||
return typeid(Pair<std::string>);
|
||||
}
|
||||
|
||||
void convert(Int8& val) const
|
||||
void convert(Int8&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int8");
|
||||
}
|
||||
|
||||
void convert(Int16& val) const
|
||||
void convert(Int16&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int16");
|
||||
}
|
||||
|
||||
void convert(Int32& val) const
|
||||
void convert(Int32&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int32");
|
||||
}
|
||||
|
||||
void convert(Int64& val) const
|
||||
void convert(Int64&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int64");
|
||||
}
|
||||
|
||||
void convert(UInt8& val) const
|
||||
void convert(UInt8&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt8");
|
||||
}
|
||||
|
||||
void convert(UInt16& val) const
|
||||
void convert(UInt16&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt16");
|
||||
}
|
||||
|
||||
void convert(UInt32& val) const
|
||||
void convert(UInt32&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt32");
|
||||
}
|
||||
|
||||
void convert(UInt64& val) const
|
||||
void convert(UInt64&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt64");
|
||||
}
|
||||
|
||||
void convert(bool& val) const
|
||||
void convert(bool&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to bool");
|
||||
}
|
||||
|
||||
void convert(float& val) const
|
||||
void convert(float&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to float");
|
||||
}
|
||||
|
||||
void convert(double& val) const
|
||||
void convert(double&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to double");
|
||||
}
|
||||
|
||||
void convert(char& val) const
|
||||
void convert(char&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to char");
|
||||
}
|
||||
@ -271,62 +269,62 @@ public:
|
||||
return typeid(Pair<int>);
|
||||
}
|
||||
|
||||
void convert(Int8& val) const
|
||||
void convert(Int8&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int8");
|
||||
}
|
||||
|
||||
void convert(Int16& val) const
|
||||
void convert(Int16&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int16");
|
||||
}
|
||||
|
||||
void convert(Int32& val) const
|
||||
void convert(Int32&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int32");
|
||||
}
|
||||
|
||||
void convert(Int64& val) const
|
||||
void convert(Int64&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to Int64");
|
||||
}
|
||||
|
||||
void convert(UInt8& val) const
|
||||
void convert(UInt8&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt8");
|
||||
}
|
||||
|
||||
void convert(UInt16& val) const
|
||||
void convert(UInt16&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt16");
|
||||
}
|
||||
|
||||
void convert(UInt32& val) const
|
||||
void convert(UInt32&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt32");
|
||||
}
|
||||
|
||||
void convert(UInt64& val) const
|
||||
void convert(UInt64&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to UInt64");
|
||||
}
|
||||
|
||||
void convert(bool& val) const
|
||||
void convert(bool&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to bool");
|
||||
}
|
||||
|
||||
void convert(float& val) const
|
||||
void convert(float&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to float");
|
||||
}
|
||||
|
||||
void convert(double& val) const
|
||||
void convert(double&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to double");
|
||||
}
|
||||
|
||||
void convert(char& val) const
|
||||
void convert(char&) const
|
||||
{
|
||||
throw BadCastException("Cannot cast Pair type to char");
|
||||
}
|
||||
|
@ -234,9 +234,9 @@ std::wstring EventLogChannel::findLibrary(const wchar_t* name)
|
||||
if (dll)
|
||||
{
|
||||
const DWORD maxPathLen = MAX_PATH + 1;
|
||||
wchar_t name[maxPathLen];
|
||||
int n = GetModuleFileNameW(dll, name, maxPathLen);
|
||||
if (n > 0) path = name;
|
||||
wchar_t moduleName[maxPathLen];
|
||||
int n = GetModuleFileNameW(dll, moduleName, maxPathLen);
|
||||
if (n > 0) path = moduleName;
|
||||
FreeLibrary(dll);
|
||||
}
|
||||
return path;
|
||||
|
@ -485,7 +485,7 @@ public:
|
||||
if (!_pPool)
|
||||
{
|
||||
_pPool = new ThreadPool("default");
|
||||
if (POCO_THREAD_STACK_SIZE > 0)
|
||||
if constexpr (POCO_THREAD_STACK_SIZE > 0)
|
||||
_pPool->setStackSize(POCO_THREAD_STACK_SIZE);
|
||||
}
|
||||
return _pPool;
|
||||
|
@ -146,7 +146,7 @@ private:
|
||||
try { TU POCO_UNUSED i; i = dMin.convert<TU>(); fail("must fail"); }
|
||||
catch (Poco::RangeException&) {}
|
||||
|
||||
if(sizeof(TS) == sizeof(TU))
|
||||
if constexpr (sizeof(TS) == sizeof(TU))
|
||||
{
|
||||
TU iMax = std::numeric_limits<TU>::max();
|
||||
Poco::Dynamic::Var dMax = iMax;
|
||||
|
Loading…
Reference in New Issue
Block a user