From 1eebd46c0487356fc3c89991ddc160ab97a6f001 Mon Sep 17 00:00:00 2001 From: Matej Kenda Date: Tue, 30 Jul 2024 15:09:58 +0200 Subject: [PATCH] Cppunit and data test enhancements (#4616) * enh(CppUnit): Source code enhancements. * enh(DataTest): Code enhancements (mostly to use override) to prevent wrong test calls when renaming. --- CppUnit/include/CppUnit/CppUnitException.h | 4 +- CppUnit/include/CppUnit/Orthodox.h | 2 +- CppUnit/include/CppUnit/RepeatedTest.h | 2 +- CppUnit/include/CppUnit/TestCase.h | 1 - CppUnit/src/TestCase.cpp | 6 +- CppUnit/src/TestDecorator.cpp | 4 +- CppUnit/src/TestRunner.cpp | 41 +++++++------ CppUnit/src/TestSuite.cpp | 12 ++-- Data/DataTest/CMakeLists.txt | 2 +- .../include/Poco/Data/Test/SQLExecutor.h | 6 +- .../ODBC/include/Poco/Data/ODBC/Diagnostics.h | 6 +- Data/ODBC/testsuite/src/ODBCAccessTest.h | 6 +- Data/ODBC/testsuite/src/ODBCDB2Test.h | 48 +++++++-------- Data/ODBC/testsuite/src/ODBCMySQLTest.h | 48 +++++++-------- Data/ODBC/testsuite/src/ODBCOracleTest.h | 54 ++++++++--------- Data/ODBC/testsuite/src/ODBCPostgreSQLTest.h | 48 +++++++-------- Data/ODBC/testsuite/src/ODBCSQLServerTest.h | 60 +++++++++---------- Data/ODBC/testsuite/src/ODBCSQLiteTest.h | 36 +++++------ Data/ODBC/testsuite/src/ODBCTest.h | 8 +-- Data/ODBC/testsuite/src/SQLExecutor.h | 11 ++-- 20 files changed, 199 insertions(+), 206 deletions(-) diff --git a/CppUnit/include/CppUnit/CppUnitException.h b/CppUnit/include/CppUnit/CppUnitException.h index b0583a384..5562ce597 100644 --- a/CppUnit/include/CppUnit/CppUnitException.h +++ b/CppUnit/include/CppUnit/CppUnitException.h @@ -33,11 +33,11 @@ public: long data2lineNumber, const std::string& fileName); CppUnitException(const CppUnitException& other); - virtual ~CppUnitException() noexcept; + ~CppUnitException() noexcept override; CppUnitException& operator = (const CppUnitException& other); - const char* what() const noexcept; + const char* what() const noexcept override; long lineNumber() const; long data1LineNumber() const; diff --git a/CppUnit/include/CppUnit/Orthodox.h b/CppUnit/include/CppUnit/Orthodox.h index ac08c0100..3363e5f66 100644 --- a/CppUnit/include/CppUnit/Orthodox.h +++ b/CppUnit/include/CppUnit/Orthodox.h @@ -55,7 +55,7 @@ public: protected: ClassUnderTest call(ClassUnderTest object); - void runTest (); + void runTest () override; }; diff --git a/CppUnit/include/CppUnit/RepeatedTest.h b/CppUnit/include/CppUnit/RepeatedTest.h index 9dfdf38b2..0bdbc9a67 100644 --- a/CppUnit/include/CppUnit/RepeatedTest.h +++ b/CppUnit/include/CppUnit/RepeatedTest.h @@ -34,7 +34,7 @@ public: int countTestCases(); std::string toString(); - void run(TestResult* result, const Test::Callback& callback = nullptr); + void run(TestResult* result, const Test::Callback& callback = nullptr) override; private: const int _timesRepeat; diff --git a/CppUnit/include/CppUnit/TestCase.h b/CppUnit/include/CppUnit/TestCase.h index 976660586..73c6bb163 100644 --- a/CppUnit/include/CppUnit/TestCase.h +++ b/CppUnit/include/CppUnit/TestCase.h @@ -13,7 +13,6 @@ #include "CppUnit/TestResult.h" #include "CppUnit/CppUnitException.h" #include -#include #include #include diff --git a/CppUnit/src/TestCase.cpp b/CppUnit/src/TestCase.cpp index eda37e242..002905477 100644 --- a/CppUnit/src/TestCase.cpp +++ b/CppUnit/src/TestCase.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include "CppUnit/TestCase.h" #include "CppUnit/TestResult.h" #include "CppUnit/estring.h" @@ -117,7 +117,7 @@ void TestCase::run(TestResult *result, const Test::Callback& callback) } catch (CppUnitException& e) { - CppUnitException* copy = new CppUnitException(e); + auto* copy = new CppUnitException(e); result->addFailure(this, copy); } catch (std::exception& e) @@ -128,7 +128,7 @@ void TestCase::run(TestResult *result, const Test::Callback& callback) } catch (...) { - CppUnitException *e = new CppUnitException ("unknown exception"); + auto* e = new CppUnitException ("unknown exception"); result->addError (this, e); } tearDown (); diff --git a/CppUnit/src/TestDecorator.cpp b/CppUnit/src/TestDecorator.cpp index 281289d96..16153cc2c 100644 --- a/CppUnit/src/TestDecorator.cpp +++ b/CppUnit/src/TestDecorator.cpp @@ -15,9 +15,7 @@ TestDecorator::TestDecorator(Test* test) } -TestDecorator::~TestDecorator() -{ -} +TestDecorator::~TestDecorator() = default; int TestDecorator::countTestCases() const diff --git a/CppUnit/src/TestRunner.cpp b/CppUnit/src/TestRunner.cpp index 31c54ec95..a92b5684b 100644 --- a/CppUnit/src/TestRunner.cpp +++ b/CppUnit/src/TestRunner.cpp @@ -8,7 +8,6 @@ #include "CppUnit/TestSuite.h" #include "CppUnit/TextTestResult.h" #include -#include namespace CppUnit { @@ -28,8 +27,8 @@ TestRunner::TestRunner(std::ostream& ostr): TestRunner::~TestRunner() { - for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it) - delete it->second; + for (auto & _mapping : _mappings) + delete _mapping.second; } @@ -80,9 +79,9 @@ bool TestRunner::run(const std::vector& args, const Test::Callback& } else if (arg == "-print") { - for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it) + for (auto& _mapping : _mappings) { - print(it->first, it->second, 0); + print(_mapping.first, _mapping.second, 0); } printed = true; continue; @@ -104,8 +103,8 @@ bool TestRunner::run(const std::vector& args, const Test::Callback& return false; } - Test* testToRun = 0; - for (Mappings::iterator it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it) + Test* testToRun = nullptr; + for (auto it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it) { testToRun = find(testCase, it->second, it->first); } @@ -124,18 +123,18 @@ bool TestRunner::run(const std::vector& args, const Test::Callback& if (all) { tests.clear(); - for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it) + for (auto& _mapping : _mappings) { - collectAllTestCases(it->second, tests); + collectAllTestCases(_mapping.second, tests); } } TextTestResult result(_ostr, ignore); - for (std::vector::const_iterator it = tests.begin(); it != tests.end(); ++it) + for (auto testToRun : tests) { - Test* testToRun = *it; if(testToRun->getType() == Test::Long && !longRunning) continue; + if (setup.size() > 0) testToRun->addSetup(setup); @@ -163,7 +162,7 @@ bool TestRunner::run(const std::vector& args, const Test::Callback& void TestRunner::addTest(const std::string& name, Test* test) { - _mappings.push_back(Mapping(name, test)); + _mappings.emplace_back(name, test); } @@ -176,9 +175,9 @@ void TestRunner::print(const std::string& name, Test* pTest, int indent) if (pSuite) { const std::vector& tests = pSuite->tests(); - for (std::vector::const_iterator it = tests.begin(); it != tests.end(); ++it) + for (auto* test : tests) { - print((*it)->toString(), *it, indent + 1); + print(test->toString(), test, indent + 1); } } } @@ -192,17 +191,17 @@ Test* TestRunner::find(const std::string& name, Test* pTest, const std::string& } else { - TestSuite* pSuite = dynamic_cast(pTest); + auto* pSuite = dynamic_cast(pTest); if (pSuite) { const std::vector& tests = pSuite->tests(); - for (std::vector::const_iterator it = tests.begin(); it != tests.end(); ++it) + for (auto* test : tests) { - Test* result = find(name, *it, (*it)->toString()); + Test* result = find(name, test, test->toString()); if (result) return result; } } - return 0; + return nullptr; } } @@ -212,14 +211,14 @@ int TestRunner::collectAllTestCases(Test* pTest, std::vector& testcases) int added = 0; if (pTest->getType() == Test::Suite) { - TestSuite* pSuite = dynamic_cast(pTest); + auto* pSuite = dynamic_cast(pTest); if (pSuite) { const std::vector& tests = pSuite->tests(); - for (std::vector::const_iterator it = tests.begin(); it != tests.end(); ++it) + for (auto* test : tests) { - added += collectAllTestCases(*it, testcases); + added += collectAllTestCases(test, testcases); } } } diff --git a/CppUnit/src/TestSuite.cpp b/CppUnit/src/TestSuite.cpp index 1ba61678e..747bd0155 100644 --- a/CppUnit/src/TestSuite.cpp +++ b/CppUnit/src/TestSuite.cpp @@ -13,22 +13,22 @@ namespace CppUnit { // Deletes all tests in the suite. void TestSuite::deleteContents() { - for (std::vector::iterator it = _tests.begin(); it != _tests.end(); ++it) - delete *it; + for (auto* _test : _tests) + delete _test; } // Runs the tests and collects their result in a TestResult. void TestSuite::run(TestResult *result, const Test::Callback& callback) { - for (std::vector::iterator it = _tests.begin(); it != _tests.end(); ++it) + for (auto* test : _tests) { if (result->shouldStop()) break; - Test *test = *it; if (!setup().empty()) test->addSetup(setup()); + test->run(result, callback); } } @@ -39,8 +39,8 @@ int TestSuite::countTestCases() const { int count = 0; - for (std::vector::const_iterator it = _tests.begin(); it != _tests.end(); ++it) - count += (*it)->countTestCases(); + for (auto* _test : _tests) + count += _test->countTestCases(); return count; } diff --git a/Data/DataTest/CMakeLists.txt b/Data/DataTest/CMakeLists.txt index 10a44858d..5801195ca 100644 --- a/Data/DataTest/CMakeLists.txt +++ b/Data/DataTest/CMakeLists.txt @@ -3,7 +3,7 @@ file(GLOB SRCS_G ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) POCO_SOURCES_AUTO(DATA_TEST_LIB_SRCS ${SRCS_G}) # Headers -file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h) +file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/Poco/Data/Test/*.h) POCO_HEADERS_AUTO(DATA_TEST_LIB_SRCS ${HDRS_G}) # Version Resource diff --git a/Data/DataTest/include/Poco/Data/Test/SQLExecutor.h b/Data/DataTest/include/Poco/Data/Test/SQLExecutor.h index 8833fa2a9..e557b717d 100644 --- a/Data/DataTest/include/Poco/Data/Test/SQLExecutor.h +++ b/Data/DataTest/include/Poco/Data/Test/SQLExecutor.h @@ -14,15 +14,13 @@ #define DataTest_SQLExecutor_INCLUDED +#include "CppUnit/TestCase.h" #include "Poco/Data/Test/DataTest.h" #include "Poco/Data/Session.h" #include "Poco/Data/BulkExtraction.h" #include "Poco/Data/BulkBinding.h" -#include "Poco/NumberFormatter.h" -#include "Poco/String.h" #include "Poco/Exception.h" #include -#include namespace Poco { @@ -55,7 +53,7 @@ public: }; SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = nullptr, bool numberedPlaceHolders = false); - ~SQLExecutor(); + ~SQLExecutor() override; template void connection(C& c, const std::string& connectString) diff --git a/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h b/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h index 4e0ffbe64..fa7585be4 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Diagnostics.h @@ -45,9 +45,9 @@ class Diagnostics { public: - inline static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1; - inline static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1; - inline static const unsigned int SQL_NAME_LENGTH = 128; + static constexpr unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1; + static constexpr unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1; + static constexpr unsigned int SQL_NAME_LENGTH = 128; inline static const std::string DATA_TRUNCATED; struct DiagnosticFields diff --git a/Data/ODBC/testsuite/src/ODBCAccessTest.h b/Data/ODBC/testsuite/src/ODBCAccessTest.h index 18bd6ce11..7b48b2c76 100644 --- a/Data/ODBC/testsuite/src/ODBCAccessTest.h +++ b/Data/ODBC/testsuite/src/ODBCAccessTest.h @@ -32,12 +32,12 @@ class ODBCAccessTest: public CppUnit::TestCase { public: ODBCAccessTest(const std::string& name); - ~ODBCAccessTest(); + ~ODBCAccessTest() override; void testSimpleAccess(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; static CppUnit::Test* suite(); diff --git a/Data/ODBC/testsuite/src/ODBCDB2Test.h b/Data/ODBC/testsuite/src/ODBCDB2Test.h index 821eba601..56808f2d9 100644 --- a/Data/ODBC/testsuite/src/ODBCDB2Test.h +++ b/Data/ODBC/testsuite/src/ODBCDB2Test.h @@ -28,37 +28,37 @@ class ODBCDB2Test: public ODBCTest { public: ODBCDB2Test(const std::string& name); - ~ODBCDB2Test(); + ~ODBCDB2Test() override; - void testBareboneODBC(); + void testBareboneODBC() override; - void testBLOB(); - void testFilter(); + void testBLOB() override; + void testFilter() override; - void testStoredProcedure(); - void testStoredProcedureAny(); - void testStoredProcedureDynamicVar(); - void testStoredFunction(); + void testStoredProcedure() override; + void testStoredProcedureAny() override; + void testStoredProcedureDynamicVar() override; + void testStoredFunction() override; static CppUnit::Test* suite(); private: - void dropObject(const std::string& type, const std::string& tableName); - void recreateNullableTable(); - void recreatePersonTable(); - void recreatePersonBLOBTable(); - void recreatePersonDateTable(); - void recreatePersonTimeTable(); - void recreatePersonDateTimeTable(); - void recreateStringsTable(); - void recreateIntsTable(); - void recreateFloatsTable(); - void recreateTuplesTable(); - void recreateVectorsTable(); - void recreateAnysTable(); - void recreateNullsTable(const std::string& notNull = ""); - void recreateMiscTable(); - void recreateLogTable(); + void dropObject(const std::string& type, const std::string& tableName) override; + void recreateNullableTable() override; + void recreatePersonTable() override; + void recreatePersonBLOBTable() override; + void recreatePersonDateTable() override; + void recreatePersonTimeTable() override; + void recreatePersonDateTimeTable() override; + void recreateStringsTable() override; + void recreateIntsTable() override; + void recreateFloatsTable() override; + void recreateTuplesTable() override; + void recreateVectorsTable() override; + void recreateAnysTable() override; + void recreateNullsTable(const std::string& notNull = "") override; + void recreateMiscTable() override; + void recreateLogTable() override; static ODBCTest::SessionPtr _pSession; static ODBCTest::ExecPtr _pExecutor; diff --git a/Data/ODBC/testsuite/src/ODBCMySQLTest.h b/Data/ODBC/testsuite/src/ODBCMySQLTest.h index ce1104109..577bf393a 100644 --- a/Data/ODBC/testsuite/src/ODBCMySQLTest.h +++ b/Data/ODBC/testsuite/src/ODBCMySQLTest.h @@ -31,39 +31,39 @@ class ODBCMySQLTest: public ODBCTest { public: ODBCMySQLTest(const std::string& name); - ~ODBCMySQLTest(); + ~ODBCMySQLTest() override; - void testBareboneODBC(); + void testBareboneODBC() override; - void testBLOB(); + void testBLOB() override; - void testStoredProcedure(); - void testStoredFunction(); + void testStoredProcedure() override; + void testStoredFunction() override; - void testNull(); + void testNull() override; - void testMultipleResults(); - void testFilter(); + void testMultipleResults() override; + void testFilter() override; static CppUnit::Test* suite(); private: - void dropObject(const std::string& type, const std::string& name); - void recreateNullableTable(); - void recreatePersonTable(); - void recreatePersonBLOBTable(); - void recreatePersonDateTable(); - void recreatePersonTimeTable(); - void recreatePersonDateTimeTable(); - void recreateStringsTable(); - void recreateIntsTable(); - void recreateFloatsTable(); - void recreateTuplesTable(); - void recreateVectorsTable(); - void recreateAnysTable(); - void recreateNullsTable(const std::string& notNull = ""); - void recreateMiscTable(); - void recreateLogTable(); + void dropObject(const std::string& type, const std::string& name) override; + void recreateNullableTable() override; + void recreatePersonTable() override; + void recreatePersonBLOBTable() override; + void recreatePersonDateTable() override; + void recreatePersonTimeTable() override; + void recreatePersonDateTimeTable() override; + void recreateStringsTable() override; + void recreateIntsTable() override; + void recreateFloatsTable() override; + void recreateTuplesTable() override; + void recreateVectorsTable() override; + void recreateAnysTable() override; + void recreateNullsTable(const std::string& notNull = "") override; + void recreateMiscTable() override; + void recreateLogTable() override; static ODBCTest::SessionPtr _pSession; static ODBCTest::ExecPtr _pExecutor; diff --git a/Data/ODBC/testsuite/src/ODBCOracleTest.h b/Data/ODBC/testsuite/src/ODBCOracleTest.h index b8d76163a..a4df4a21b 100644 --- a/Data/ODBC/testsuite/src/ODBCOracleTest.h +++ b/Data/ODBC/testsuite/src/ODBCOracleTest.h @@ -30,47 +30,47 @@ class ODBCOracleTest: public ODBCTest { public: ODBCOracleTest(const std::string& name); - ~ODBCOracleTest(); + ~ODBCOracleTest() override; - void testBareboneODBC(); + void testBareboneODBC() override; - void testBLOB(); + void testBLOB() override; - void testMultipleResults(); + void testMultipleResults() override; - virtual void testTransaction(); + void testTransaction() override; - void testStoredProcedure(); + void testStoredProcedure() override; void testCursorStoredProcedure(); - void testStoredFunction(); + void testStoredFunction() override; void testCursorStoredFunction(); - void testStoredProcedureAny(); - void testStoredProcedureDynamicVar(); + void testStoredProcedureAny() override; + void testStoredProcedureDynamicVar() override; void testAutoTransaction(); - void testNull(); + void testNull() override; static CppUnit::Test* suite(); private: static void testBarebone(); - void dropObject(const std::string& type, const std::string& name); - void recreateNullableTable(); - void recreatePersonTable(); - void recreatePersonTupleTable(); - void recreatePersonBLOBTable(); - void recreatePersonDateTable(); - void recreatePersonDateTimeTable(); - void recreateStringsTable(); - void recreateIntsTable(); - void recreateFloatsTable(); - void recreateTuplesTable(); - void recreateVectorsTable(); - void recreateAnysTable(); - void recreateNullsTable(const std::string& notNull = ""); - void recreateMiscTable(); - void recreateLogTable(); - void recreateUnicodeTable(); + void dropObject(const std::string& type, const std::string& name) override; + void recreateNullableTable() override; + void recreatePersonTable() override; + void recreatePersonTupleTable() override; + void recreatePersonBLOBTable() override; + void recreatePersonDateTable() override; + void recreatePersonDateTimeTable() override; + void recreateStringsTable() override; + void recreateIntsTable() override; + void recreateFloatsTable() override; + void recreateTuplesTable() override; + void recreateVectorsTable() override; + void recreateAnysTable() override; + void recreateNullsTable(const std::string& notNull = "") override; + void recreateMiscTable() override; + void recreateLogTable() override; + void recreateUnicodeTable() override; static ODBCTest::SessionPtr _pSession; static ODBCTest::ExecPtr _pExecutor; diff --git a/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.h b/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.h index 37b47a7b9..694289f4e 100644 --- a/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.h +++ b/Data/ODBC/testsuite/src/ODBCPostgreSQLTest.h @@ -37,37 +37,37 @@ class ODBCPostgreSQLTest: public ODBCTest { public: ODBCPostgreSQLTest(const std::string& name); - ~ODBCPostgreSQLTest(); + ~ODBCPostgreSQLTest() override; - void testBareboneODBC(); + void testBareboneODBC() override; - void testBLOB(); + void testBLOB() override; - void testStoredFunction(); - void testStoredFunctionAny(); - void testStoredFunctionDynamicAny(); + void testStoredFunction() override; + void testStoredFunctionAny() override; + void testStoredFunctionDynamicAny() override; static CppUnit::Test* suite(); private: - void dropObject(const std::string& type, const std::string& name); - void recreateNullableTable(); - void recreatePersonTable(); - void recreatePersonBLOBTable(); - void recreatePersonDateTimeTable(); - void recreatePersonDateTable(); - void recreatePersonTimeTable(); - void recreateStringsTable(); - void recreateIntsTable(); - void recreateFloatsTable(); - void recreateTuplesTable(); - void recreateVectorsTable(); - void recreateAnysTable(); - void recreateNullsTable(const std::string& notNull=""); - void recreateBoolTable(); - void recreateMiscTable(); - void recreateLogTable(); - void recreateUnicodeTable(); + void dropObject(const std::string& type, const std::string& name) override; + void recreateNullableTable() override; + void recreatePersonTable() override; + void recreatePersonBLOBTable() override; + void recreatePersonDateTimeTable() override; + void recreatePersonDateTable() override; + void recreatePersonTimeTable() override; + void recreateStringsTable() override; + void recreateIntsTable() override; + void recreateFloatsTable() override; + void recreateTuplesTable() override; + void recreateVectorsTable() override; + void recreateAnysTable() override; + void recreateNullsTable(const std::string& notNull = "") override; + void recreateBoolTable() override; + void recreateMiscTable() override; + void recreateLogTable() override; + void recreateUnicodeTable() override; void configurePLPgSQL(); /// Configures PL/pgSQL in the database. A reasonable defaults diff --git a/Data/ODBC/testsuite/src/ODBCSQLServerTest.h b/Data/ODBC/testsuite/src/ODBCSQLServerTest.h index ba05b2edb..61f95be9b 100644 --- a/Data/ODBC/testsuite/src/ODBCSQLServerTest.h +++ b/Data/ODBC/testsuite/src/ODBCSQLServerTest.h @@ -40,51 +40,51 @@ class ODBCSQLServerTest: public ODBCTest { public: ODBCSQLServerTest(const std::string& name); - ~ODBCSQLServerTest(); + ~ODBCSQLServerTest() override; - void testBareboneODBC(); + void testBareboneODBC() override; - void testTempTable(); + void testTempTable() override; - void testBLOB(); + void testBLOB() override; void testBigString(); void testBigBatch(); - void testNull(); - void testBulk(); + void testNull() override; + void testBulk() override; - void testStoredProcedure(); + void testStoredProcedure() override; void testCursorStoredProcedure(); - void testStoredProcedureAny(); - void testStoredProcedureDynamicVar(); + void testStoredProcedureAny() override; + void testStoredProcedureDynamicVar() override; void testStoredProcedureReturn(); - void testStoredFunction(); + void testStoredFunction() override; static CppUnit::Test* suite(); private: - void dropObject(const std::string& type, const std::string& name); - void recreateNullableTable(); - void recreatePersonTable(); - void recreatePersonBLOBTable(); + void dropObject(const std::string& type, const std::string& name) override; + void recreateNullableTable() override; + void recreatePersonTable() override; + void recreatePersonBLOBTable() override; void recreatePersonBigStringTable(); - void recreatePersonDateTimeTable(); - void recreatePersonDateTable() { /* no-op */ }; - void recreatePersonTimeTable() { /* no-op */ }; - void recreateStringsTable(); - void recreateIntsTable(); - void recreateFloatsTable(); - void recreateUUIDsTable(); - void recreateTuplesTable(); + void recreatePersonDateTimeTable() override; + void recreatePersonDateTable() override { /* no-op */ }; + void recreatePersonTimeTable() override { /* no-op */ }; + void recreateStringsTable() override; + void recreateIntsTable() override; + void recreateFloatsTable() override; + void recreateUUIDsTable() override; + void recreateTuplesTable() override; void recreateVectorTable(); - void recreateVectorsTable(); - void recreateAnysTable(); - void recreateNullsTable(const std::string& notNull = ""); - void recreateBoolTable(); - void recreateMiscTable(); - void recreateLogTable(); - void recreateUnicodeTable(); - void recreateEncodingTables(); + void recreateVectorsTable() override; + void recreateAnysTable() override; + void recreateNullsTable(const std::string& notNull = "") override; + void recreateBoolTable() override; + void recreateMiscTable() override; + void recreateLogTable() override; + void recreateUnicodeTable() override; + void recreateEncodingTables() override; static SessionPtr _pSession; static SessionPtr _pEncSession; diff --git a/Data/ODBC/testsuite/src/ODBCSQLiteTest.h b/Data/ODBC/testsuite/src/ODBCSQLiteTest.h index b878c1574..4789ad605 100644 --- a/Data/ODBC/testsuite/src/ODBCSQLiteTest.h +++ b/Data/ODBC/testsuite/src/ODBCSQLiteTest.h @@ -28,29 +28,29 @@ class ODBCSQLiteTest: public ODBCTest { public: ODBCSQLiteTest(const std::string& name); - ~ODBCSQLiteTest(); + ~ODBCSQLiteTest() override; - void testBareboneODBC(); - void testAffectedRows(); - void testNull(); + void testBareboneODBC() override; + void testAffectedRows() override; + void testNull() override; static CppUnit::Test* suite(); private: - void dropObject(const std::string& type, const std::string& name); - void recreateNullableTable(); - void recreatePersonTable(); - void recreatePersonBLOBTable(); - void recreatePersonDateTimeTable(); - void recreateStringsTable(); - void recreateIntsTable(); - void recreateFloatsTable(); - void recreateTuplesTable(); - void recreateVectorsTable(); - void recreateAnysTable(); - void recreateNullsTable(const std::string& notNull = ""); - void recreateMiscTable(); - void recreateLogTable(); + void dropObject(const std::string& type, const std::string& name) override; + void recreateNullableTable() override; + void recreatePersonTable() override; + void recreatePersonBLOBTable() override; + void recreatePersonDateTimeTable() override; + void recreateStringsTable() override; + void recreateIntsTable() override; + void recreateFloatsTable() override; + void recreateTuplesTable() override; + void recreateVectorsTable() override; + void recreateAnysTable() override; + void recreateNullsTable(const std::string& notNull = "") override; + void recreateMiscTable() override; + void recreateLogTable() override; static ODBCTest::SessionPtr _pSession; static ODBCTest::ExecPtr _pExecutor; diff --git a/Data/ODBC/testsuite/src/ODBCTest.h b/Data/ODBC/testsuite/src/ODBCTest.h index 16b733e55..931fa6e7a 100644 --- a/Data/ODBC/testsuite/src/ODBCTest.h +++ b/Data/ODBC/testsuite/src/ODBCTest.h @@ -40,10 +40,10 @@ public: std::string& rPwd, std::string& rConnectString); - ~ODBCTest(); + ~ODBCTest() override; - virtual void setUp(); - virtual void tearDown(); + void setUp() override; + void tearDown() override; virtual void testBareboneODBC() = 0; @@ -166,7 +166,7 @@ public: virtual void testReconnect(); protected: - typedef Poco::Data::ODBC::Utility::DriverMap Drivers; + using Drivers = Poco::Data::ODBC::Utility::DriverMap; virtual void dropObject(const std::string& type, const std::string& name); virtual void recreateNullableTable(); diff --git a/Data/ODBC/testsuite/src/SQLExecutor.h b/Data/ODBC/testsuite/src/SQLExecutor.h index 128926717..6448fb8d5 100644 --- a/Data/ODBC/testsuite/src/SQLExecutor.h +++ b/Data/ODBC/testsuite/src/SQLExecutor.h @@ -13,16 +13,13 @@ #ifndef SQLExecutor_INCLUDED #define SQLExecutor_INCLUDED - -#include "Poco/Data/ODBC/ODBC.h" -#include "Poco/Data/ODBC/Utility.h" +#include "CppUnit/TestCase.h" #include "Poco/Data/ODBC/ODBCException.h" #include "Poco/Data/Session.h" #include "Poco/Data/BulkExtraction.h" #include "Poco/Data/BulkBinding.h" #include "Poco/Data/Test/SQLExecutor.h" #include "Poco/NumberFormatter.h" -#include "Poco/String.h" #include "Poco/Exception.h" #include @@ -88,8 +85,10 @@ public: DE_BOUND }; - SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = 0); - ~SQLExecutor(); + SQLExecutor(const std::string& name, + Poco::Data::Session* pSession, + Poco::Data::Session* pEncSession = nullptr); + ~SQLExecutor() override; void execute(const std::string& sql); /// Execute a query.