From a70a2844b1aba63643801c26c35cc0a68b03a8c1 Mon Sep 17 00:00:00 2001 From: Philip Kovacs <30226827+pkovacs@users.noreply.github.com> Date: Wed, 9 Jun 2021 07:14:15 -0400 Subject: [PATCH] Fix compiler warnings (#886) Co-authored-by: an-tao Co-authored-by: Martin Chang --- drogon_ctl/create_view.cc | 4 +- lib/inc/drogon/drogon_test.h | 36 +++++++++- .../client/HttpPipeliningTest.cc | 2 +- lib/tests/integration_test/client/main.cc | 16 ++--- lib/tests/unittests/MsgBufferTest.cc | 30 ++++----- lib/tests/unittests/PubSubServiceUnittest.cc | 4 +- lib/tests/unittests/StringOpsTest.cc | 18 ++--- nosql_lib/redis/tests/redis_test.cc | 4 +- orm_lib/tests/db_test.cc | 66 +++++++++---------- 9 files changed, 106 insertions(+), 74 deletions(-) diff --git a/drogon_ctl/create_view.cc b/drogon_ctl/create_view.cc index 9ef82e9c..57bfe22f 100644 --- a/drogon_ctl/create_view.cc +++ b/drogon_ctl/create_view.cc @@ -390,7 +390,7 @@ void create_view::newViewHeaderFile(std::ofstream &file, << "(){};\n\t" "virtual std::string genText(const drogon::DrTemplateData &) " "override;\n};\n"; - for (auto i = 0; i < namespaces_.size(); ++i) + for (std::size_t i = 0; i < namespaces_.size(); ++i) { file << "}\n"; } @@ -489,7 +489,7 @@ void create_view::newViewSourceFile(std::ofstream &file, if (!namespaces_.empty()) { file << "using namespace "; - for (int i = 0; i < namespaces_.size(); ++i) + for (std::size_t i = 0; i < namespaces_.size(); ++i) { if (i != namespaces_.size() - 1) { diff --git a/lib/inc/drogon/drogon_test.h b/lib/inc/drogon/drogon_test.h index 7334fe15..f4f987c9 100644 --- a/lib/inc/drogon/drogon_test.h +++ b/lib/inc/drogon/drogon_test.h @@ -31,6 +31,29 @@ namespace test #define DROGON_TEST_STRINGIFY(x) DROGON_TEST_STRINGIFY__(x) #define DROGON_TEST_CONCAT__(a, b) a##b #define DROGON_TEST_CONCAT(a, b) DROGON_TEST_CONCAT__(a, b) + +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) +#define DROGON_TEST_START_SUPRESSION_ _Pragma("GCC diagnostic push") +#define DROGON_TEST_END_SUPRESSION_ _Pragma("GCC diagnostic pop") +#define DROGON_TEST_SUPPRESS_PARENTHESES_WARNING_ \ + _Pragma("GCC diagnostic ignored \"-Wparentheses\"") +#define DROGON_TEST_SUPPRESS_UNUSED_VALUE_WARNING_ \ + _Pragma("GCC diagnostic ignored \"-Wunused-value\"") +#elif defined(__clang__) && !defined(_MSC_VER) +#define DROGON_TEST_START_SUPRESSION_ _Pragma("clang diagnostic push") +#define DROGON_TEST_END_SUPRESSION_ _Pragma("clang diagnostic pop") +#define DROGON_TEST_SUPPRESS_PARENTHESES_WARNING_ \ + _Pragma("clang diagnostic ignored \"-Wparentheses\"") +#define DROGON_TEST_SUPPRESS_UNUSED_VALUE_WARNING_ \ + _Pragma("clang diagnostic ignored \"-Wunused-value\"") +// MSVC don't have an equlivent. Add other compilers here +#else +#define DROGON_TEST_START_SUPRESSION_ +#define DROGON_TEST_END_SUPRESSION_ +#define DROGON_TEST_SUPPRESS_PARENTHESES_WARNING_ +#define DROGON_TEST_SUPPRESS_UNUSED_VALUE_WARNING_ +#endif + class Case; namespace internal @@ -387,8 +410,8 @@ class CaseBase : public trantor::NonCopyable protected: bool failed_ = false; - std::string name_; std::shared_ptr parent_ = nullptr; + std::string name_; }; class Case : public CaseBase @@ -676,8 +699,11 @@ static int run(int argc, char** argv) { \ bool drresult__; \ std::string drexpansion__; \ + DROGON_TEST_START_SUPRESSION_ \ + DROGON_TEST_SUPPRESS_PARENTHESES_WARNING_ \ std::tie(drresult__, drexpansion__) = \ (drogon::test::internal::Decomposer() <= expr).result(); \ + DROGON_TEST_END_SUPRESSION_ \ if (!drresult__) \ { \ ERROR_MSG(func_name, #expr) \ @@ -892,7 +918,10 @@ static int run(int argc, char** argv) #define STATIC_REQUIRE(expr) \ do \ { \ + DROGON_TEST_START_SUPRESSION_ \ + DROGON_TEST_SUPPRESS_UNUSED_VALUE_WARNING_ \ TEST_CTX; \ + DROGON_TEST_END_SUPRESSION_ \ drogon::test::internal::numAssertions++; \ static_assert((expr), #expr " failed."); \ drogon::test::internal::numCorrectAssertions++; \ @@ -923,13 +952,16 @@ static int run(int argc, char** argv) #define SUCCESS() \ do \ { \ + DROGON_TEST_START_SUPRESSION_ \ + DROGON_TEST_SUPPRESS_UNUSED_VALUE_WARNING_ \ + TEST_CTX; \ + DROGON_TEST_END_SUPRESSION_ \ if (drogon::test::internal::printSuccessfulTests) \ drogon::test::print() \ << "\x1B[1;37mIn test case " << TEST_CTX->fullname() << "\n" \ << "\x1B[0;37m↳ " << __FILE__ << ":" << __LINE__ \ << " \x1B[0;32m PASSED:\x1B[0m\n" \ << " \033[0;34mSUCCESS()\x1B[0m\n\n"; \ - TEST_CTX; \ drogon::test::internal::numAssertions++; \ drogon::test::internal::numCorrectAssertions++; \ } while (0) diff --git a/lib/tests/integration_test/client/HttpPipeliningTest.cc b/lib/tests/integration_test/client/HttpPipeliningTest.cc index aa859ab5..2826c927 100644 --- a/lib/tests/integration_test/client/HttpPipeliningTest.cc +++ b/lib/tests/integration_test/client/HttpPipeliningTest.cc @@ -35,7 +35,7 @@ DROGON_TEST(HttpPipeliningTest) client->sendRequest(request2, [TEST_CTX](ReqResult r, const HttpResponsePtr &resp) { REQUIRE(r == ReqResult::Ok); - REQUIRE(resp->getBody().length() == 44618); + REQUIRE(resp->getBody().length() == 44618UL); }); auto request = HttpRequest::newHttpRequest(); diff --git a/lib/tests/integration_test/client/main.cc b/lib/tests/integration_test/client/main.cc index 7f427d8a..e1508548 100644 --- a/lib/tests/integration_test/client/main.cc +++ b/lib/tests/integration_test/client/main.cc @@ -31,7 +31,7 @@ #include -#define JPG_LEN 44618 +#define JPG_LEN 44618UL size_t indexLen; size_t indexImplicitLen; @@ -101,7 +101,7 @@ void doTest(const HttpClientPtr &client, std::shared_ptr TEST_CTX) [req, TEST_CTX](ReqResult result, const HttpResponsePtr &resp) { REQUIRE(result == ReqResult::Ok); - CHECK(resp->getBody().length() == 4994); + CHECK(resp->getBody().length() == 4994UL); }); /// Test brotli #ifdef USE_BROTLI @@ -113,7 +113,7 @@ void doTest(const HttpClientPtr &client, std::shared_ptr TEST_CTX) [req, TEST_CTX](ReqResult result, const HttpResponsePtr &resp) { REQUIRE(result == ReqResult::Ok); - CHECK(resp->getBody().length() == 4994); + CHECK(resp->getBody().length() == 4994UL); }); #endif /// Post json @@ -351,7 +351,7 @@ void doTest(const HttpClientPtr &client, std::shared_ptr TEST_CTX) [req, TEST_CTX](ReqResult result, const HttpResponsePtr &resp) { REQUIRE(result == ReqResult::Ok); - CHECK(resp->getBody().length() == 4994); + CHECK(resp->getBody().length() == 4994UL); }); /// Test method routing, see MethodTest.h @@ -739,7 +739,7 @@ void doTest(const HttpClientPtr &client, std::shared_ptr TEST_CTX) req, [req, TEST_CTX](ReqResult result, const HttpResponsePtr &resp) { REQUIRE(result == ReqResult::Ok); CHECK(resp->getStatusCode() == k200OK); - int n; + int n = 100; CHECK_NOTHROW(n = std::stoi(std::string(resp->body()))); CHECK(n <= 2); }); @@ -751,7 +751,7 @@ void doTest(const HttpClientPtr &client, std::shared_ptr TEST_CTX) req, [req, TEST_CTX](ReqResult result, const HttpResponsePtr &resp) { REQUIRE(result == ReqResult::Ok); CHECK(resp->getStatusCode() == k200OK); - int n; + int n = 100; CHECK_NOTHROW(n = std::stoi(std::string(resp->body()))); CHECK(n <= 2); }); @@ -777,7 +777,7 @@ void doTest(const HttpClientPtr &client, std::shared_ptr TEST_CTX) req, [req, TEST_CTX](ReqResult result, const HttpResponsePtr &resp) { REQUIRE(result == ReqResult::Ok); CHECK(resp->getStatusCode() == k200OK); - int n; + int n = 100; CHECK_NOTHROW(n = std::stoi(std::string(resp->body()))); CHECK(n <= 2); }); @@ -789,7 +789,7 @@ void doTest(const HttpClientPtr &client, std::shared_ptr TEST_CTX) req, [req, TEST_CTX](ReqResult result, const HttpResponsePtr &resp) { REQUIRE(result == ReqResult::Ok); CHECK(resp->getStatusCode() == k200OK); - int n; + int n = 100; CHECK_NOTHROW(n = std::stoi(std::string(resp->body()))); CHECK(n <= 2); }); diff --git a/lib/tests/unittests/MsgBufferTest.cc b/lib/tests/unittests/MsgBufferTest.cc index 5fbf09cd..23abea8a 100644 --- a/lib/tests/unittests/MsgBufferTest.cc +++ b/lib/tests/unittests/MsgBufferTest.cc @@ -10,46 +10,46 @@ DROGON_TEST(MsgBufferTest) { MsgBuffer buffer; - CHECK(buffer.readableBytes() == 0); + CHECK(buffer.readableBytes() == 0UL); buffer.append(std::string(128, 'a')); - CHECK(buffer.readableBytes() == 128); + CHECK(buffer.readableBytes() == 128UL); buffer.retrieve(100); - CHECK(buffer.readableBytes() == 28); + CHECK(buffer.readableBytes() == 28UL); CHECK(buffer.peekInt8() == 'a'); buffer.retrieveAll(); - CHECK(buffer.readableBytes() == 0); + CHECK(buffer.readableBytes() == 0UL); } SUBSECTION(writableTest) { MsgBuffer buffer(100); - CHECK(buffer.writableBytes() == 100); + CHECK(buffer.writableBytes() == 100UL); buffer.append("abcde"); - CHECK(buffer.writableBytes() == 95); + CHECK(buffer.writableBytes() == 95UL); buffer.append(std::string(100, 'x')); - CHECK(buffer.writableBytes() == 111); + CHECK(buffer.writableBytes() == 111UL); buffer.retrieve(100); - CHECK(buffer.writableBytes() == 111); + CHECK(buffer.writableBytes() == 111UL); buffer.append(std::string(112, 'c')); - CHECK(buffer.writableBytes() == 99); + CHECK(buffer.writableBytes() == 99UL); buffer.retrieveAll(); - CHECK(buffer.writableBytes() == 216); + CHECK(buffer.writableBytes() == 216UL); } SUBSECTION(addInFrontTest) { MsgBuffer buffer(100); - CHECK(buffer.writableBytes() == 100); + CHECK(buffer.writableBytes() == 100UL); buffer.addInFrontInt8('a'); - CHECK(buffer.writableBytes() == 100); + CHECK(buffer.writableBytes() == 100UL); buffer.addInFrontInt64(123); - CHECK(buffer.writableBytes() == 92); + CHECK(buffer.writableBytes() == 92UL); buffer.addInFrontInt64(100); - CHECK(buffer.writableBytes() == 84); + CHECK(buffer.writableBytes() == 84UL); buffer.addInFrontInt8(1); - CHECK(buffer.writableBytes() == 84); + CHECK(buffer.writableBytes() == 84UL); } SUBSECTION(MoveAssignmentOperator) diff --git a/lib/tests/unittests/PubSubServiceUnittest.cc b/lib/tests/unittests/PubSubServiceUnittest.cc index b2962fde..3ae69c1c 100644 --- a/lib/tests/unittests/PubSubServiceUnittest.cc +++ b/lib/tests/unittests/PubSubServiceUnittest.cc @@ -12,7 +12,7 @@ DROGON_TEST(PubSubServiceTest) }); service.publish("topic1", "hello world"); service.publish("topic2", "hello world"); - CHECK(service.size() == 1); + CHECK(service.size() == 1UL); service.unsubscribe("topic1", id); - CHECK(service.size() == 0); + CHECK(service.size() == 0UL); } diff --git a/lib/tests/unittests/StringOpsTest.cc b/lib/tests/unittests/StringOpsTest.cc index adce66f7..4eaa0582 100644 --- a/lib/tests/unittests/StringOpsTest.cc +++ b/lib/tests/unittests/StringOpsTest.cc @@ -65,17 +65,17 @@ DROGON_TEST(StringOpsTest) // splitStringToSet ignores empty strings std::string str = "1,2,3,3,,4"; auto s = utils::splitStringToSet(str, ","); - CHECK(s.size() == 4); - CHECK(s.count("1") == 1); - CHECK(s.count("2") == 1); - CHECK(s.count("3") == 1); - CHECK(s.count("4") == 1); + CHECK(s.size() == 4UL); + CHECK(s.count("1") == 1UL); + CHECK(s.count("2") == 1UL); + CHECK(s.count("3") == 1UL); + CHECK(s.count("4") == 1UL); str = "a|||a"; s = utils::splitStringToSet(str, "||"); - CHECK(s.size() == 2); - CHECK(s.count("a") == 1); - CHECK(s.count("|a") == 1); + CHECK(s.size() == 2UL); + CHECK(s.count("a") == 1UL); + CHECK(s.count("|a") == 1UL); } SUBSECTION(ReplaceAll) @@ -88,4 +88,4 @@ DROGON_TEST(StringOpsTest) utils::replaceAll(str, "xx", "oo"); CHECK(str == "aaooxaaooooaaoooox"); } -} \ No newline at end of file +} diff --git a/nosql_lib/redis/tests/redis_test.cc b/nosql_lib/redis/tests/redis_test.cc index a65bbdf7..011fa578 100644 --- a/nosql_lib/redis/tests/redis_test.cc +++ b/nosql_lib/redis/tests/redis_test.cc @@ -38,7 +38,7 @@ DROGON_TEST(RedisTest) redisClient->execCommandAsync( [TEST_CTX](const drogon::nosql::RedisResult &r) { MANDATE(r.type() == RedisResultType::kArray); - MANDATE(r.asArray().size() == 1); + MANDATE(r.asArray().size() == 1UL); }, [TEST_CTX](const std::exception &err) { MANDATE(err.what()); }, "keys *"); @@ -101,4 +101,4 @@ int main(int argc, char **argv) drogon::app().getLoop()->queueInLoop([]() { drogon::app().quit(); }); thr.join(); return testStatus; -} \ No newline at end of file +} diff --git a/orm_lib/tests/db_test.cc b/orm_lib/tests/db_test.cc index 9bb5b7ab..de3bf28d 100644 --- a/orm_lib/tests/db_test.cc +++ b/orm_lib/tests/db_test.cc @@ -1305,7 +1305,7 @@ DROGON_TEST(SQLite3Test) << "postgresql" << "123" << "default" >> - [TEST_CTX](const Result &r) { MANDATE(r.insertId() == 1); } >> + [TEST_CTX](const Result &r) { MANDATE(r.insertId() == 1ULL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(0) what():" + std::string(e.base().what())); @@ -1317,21 +1317,21 @@ DROGON_TEST(SQLite3Test) << "postgresql1" << "123" << "default" << Mode::Blocking >> - [TEST_CTX](const Result &r) { MANDATE(r.insertId() == 2); } >> + [TEST_CTX](const Result &r) { MANDATE(r.insertId() == 2ULL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(1) what():" + std::string(e.base().what())); }; /// 1.3 query,no-blocking *clientPtr << "select * from users where 1 = 1" << Mode::NonBlocking >> - [TEST_CTX](const Result &r) { MANDATE(r.size() == 2); } >> + [TEST_CTX](const Result &r) { MANDATE(r.size() == 2UL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(2) what():" + std::string(e.base().what())); }; /// 1.4 query,blocking *clientPtr << "select * from users where 1 = 1" << Mode::Blocking >> - [TEST_CTX](const Result &r) { MANDATE(r.size() == 2); } >> + [TEST_CTX](const Result &r) { MANDATE(r.size() == 2UL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(3) what():" + std::string(e.base().what())); @@ -1357,7 +1357,7 @@ DROGON_TEST(SQLite3Test) }; /// 1.6 query, parameter binding *clientPtr << "select * from users where id = ?" << 1 >> - [TEST_CTX](const Result &r) { MANDATE(r.size() == 1); } >> + [TEST_CTX](const Result &r) { MANDATE(r.size() == 1UL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(5) what():" + std::string(e.base().what())); @@ -1366,7 +1366,7 @@ DROGON_TEST(SQLite3Test) *clientPtr << "select * from users where user_id = ? and user_name = ?" << "pg1" << "postgresql1" >> - [TEST_CTX](const Result &r) { MANDATE(r.size() == 1); } >> + [TEST_CTX](const Result &r) { MANDATE(r.size() == 1UL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(6) what():" + std::string(e.base().what())); @@ -1375,7 +1375,7 @@ DROGON_TEST(SQLite3Test) *clientPtr << "delete from users where user_id = ? and user_name = ?" << "pg1" << "postgresql1" >> - [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1); } >> + [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1UL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(7) what():" + std::string(e.base().what())); @@ -1387,7 +1387,7 @@ DROGON_TEST(SQLite3Test) << "postgresql1" << "pg" << "postgresql" >> - [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1); } >> + [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1UL); } >> [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient streaming-type interface(8) what():" + std::string(e.base().what())); @@ -1411,7 +1411,7 @@ DROGON_TEST(SQLite3Test) "insert into users \ (user_id,user_name,password,org_name) \ values(?,?,?,?)", - [TEST_CTX](const Result &r) { MANDATE(r.insertId() == 1); }, + [TEST_CTX](const Result &r) { MANDATE(r.insertId() == 1ULL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient asynchronous interface(0) what():" + std::string(e.base().what())); @@ -1425,7 +1425,7 @@ DROGON_TEST(SQLite3Test) "insert into users \ (user_id,user_name,password,org_name) \ values(?,?,?,?)", - [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1); }, + [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient asynchronous interface(1) what():" + std::string(e.base().what())); @@ -1437,7 +1437,7 @@ DROGON_TEST(SQLite3Test) /// 2.3 query clientPtr->execSqlAsync( "select * from users where 1 = 1", - [TEST_CTX](const Result &r) { MANDATE(r.size() == 2); }, + [TEST_CTX](const Result &r) { MANDATE(r.size() == 2UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient asynchronous interface(2) what():" + std::string(e.base().what())); @@ -1445,7 +1445,7 @@ DROGON_TEST(SQLite3Test) /// 2.2 query, parameter binding clientPtr->execSqlAsync( "select * from users where id = ?", - [TEST_CTX](const Result &r) { MANDATE(r.size() == 1); }, + [TEST_CTX](const Result &r) { MANDATE(r.size() == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient asynchronous interface(3) what():" + std::string(e.base().what())); @@ -1454,7 +1454,7 @@ DROGON_TEST(SQLite3Test) /// 2.3 query, parameter binding clientPtr->execSqlAsync( "select * from users where user_id = ? and user_name = ?", - [TEST_CTX](const Result &r) { MANDATE(r.size() == 1); }, + [TEST_CTX](const Result &r) { MANDATE(r.size() == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient asynchronous interface(4) what():" + std::string(e.base().what())); @@ -1464,7 +1464,7 @@ DROGON_TEST(SQLite3Test) /// 2.4 delete clientPtr->execSqlAsync( "delete from users where user_id = ? and user_name = ?", - [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1); }, + [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient asynchronous interface(5) what():" + std::string(e.base().what())); @@ -1475,7 +1475,7 @@ DROGON_TEST(SQLite3Test) clientPtr->execSqlAsync( "update users set user_id = ?, user_name = ? where user_id " "= ? and user_name = ?", - [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1); }, + [TEST_CTX](const Result &r) { MANDATE(r.affectedRows() == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - DbClient asynchronous interface(6) what():" + std::string(e.base().what())); @@ -1511,7 +1511,7 @@ DROGON_TEST(SQLite3Test) "postgresql", "123", "default"); - MANDATE(r.insertId() == 1); + MANDATE(r.insertId() == 1ULL); } catch (const DrogonDbException &e) { @@ -1528,7 +1528,7 @@ DROGON_TEST(SQLite3Test) "postgresql1", "123", "default"); - MANDATE(r.affectedRows() == 1); + MANDATE(r.affectedRows() == 1UL); } catch (const DrogonDbException &e) { @@ -1542,7 +1542,7 @@ DROGON_TEST(SQLite3Test) "select * from users where user_id=? and user_name=?", "pg1", "postgresql1"); - MANDATE(r.size() == 1); + MANDATE(r.size() == 1UL); } catch (const DrogonDbException &e) { @@ -1556,7 +1556,7 @@ DROGON_TEST(SQLite3Test) "select * from users where user_id=? and user_name=?", "pg111", "postgresql1"); - MANDATE(r.size() == 0); + MANDATE(r.size() == 0UL); } catch (const DrogonDbException &e) { @@ -1570,7 +1570,7 @@ DROGON_TEST(SQLite3Test) "select * from users where user_id=? and user_name='1234'", "pg111", "postgresql1"); - MANDATE(r.size() == 0); + MANDATE(r.size() == 0UL); } catch (const DrogonDbException &e) { @@ -1608,7 +1608,7 @@ DROGON_TEST(SQLite3Test) try { auto r = f.get(); - MANDATE(r.insertId() == 1); + MANDATE(r.insertId() == 1ULL); } catch (const DrogonDbException &e) { @@ -1626,7 +1626,7 @@ DROGON_TEST(SQLite3Test) try { auto r = f.get(); - MANDATE(r.affectedRows() == 1); + MANDATE(r.affectedRows() == 1UL); } catch (const DrogonDbException &e) { @@ -1641,7 +1641,7 @@ DROGON_TEST(SQLite3Test) try { auto r = f.get(); - MANDATE(r.size() == 1); + MANDATE(r.size() == 1UL); } catch (const DrogonDbException &e) { @@ -1656,7 +1656,7 @@ DROGON_TEST(SQLite3Test) try { auto r = f.get(); - MANDATE(r.size() == 0); + MANDATE(r.size() == 0UL); } catch (const DrogonDbException &e) { @@ -1671,7 +1671,7 @@ DROGON_TEST(SQLite3Test) try { auto r = f.get(); - MANDATE(r.size() == 0); + MANDATE(r.size() == 0UL); } catch (const DrogonDbException &e) { @@ -1726,7 +1726,7 @@ DROGON_TEST(SQLite3Test) "postgresql", "123", "default"); - MANDATE(r.insertId() == 1); + MANDATE(r.insertId() == 1ULL); } catch (const DrogonDbException &e) { @@ -1793,7 +1793,7 @@ DROGON_TEST(SQLite3Test) user.setOrgName("default"); mapper.insert( user, - [TEST_CTX](Users ret) { MANDATE(ret.getPrimaryKey() == 1); }, + [TEST_CTX](Users ret) { MANDATE(ret.getPrimaryKey() == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - ORM mapper asynchronous interface(0) what():" + std::string(e.base().what())); @@ -1803,7 +1803,7 @@ DROGON_TEST(SQLite3Test) user.setUserName("postgres1"); mapper.insert( user, - [TEST_CTX](Users ret) { MANDATE(ret.getPrimaryKey() == 2); }, + [TEST_CTX](Users ret) { MANDATE(ret.getPrimaryKey() == 2UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - ORM mapper asynchronous interface(1) what():" + std::string(e.base().what())); @@ -1813,7 +1813,7 @@ DROGON_TEST(SQLite3Test) Criteria(Users::Cols::_id, CompareOperator::In, std::vector{2, 200}), - [TEST_CTX](std::vector users) { MANDATE(users.size() == 1); }, + [TEST_CTX](std::vector users) { MANDATE(users.size() == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - ORM mapper asynchronous interface(2) what():" + std::string(e.base().what())); @@ -1821,7 +1821,7 @@ DROGON_TEST(SQLite3Test) /// 5.3.5 count mapper.count( drogon::orm::Criteria(Users::Cols::_id, CompareOperator::EQ, 2), - [TEST_CTX](const size_t c) { MANDATE(c == 1); }, + [TEST_CTX](const size_t c) { MANDATE(c == 1UL); }, [TEST_CTX](const DrogonDbException &e) { FAULT("sqlite3 - ORM mapper asynchronous interface(3) what():" + std::string(e.base().what())); @@ -1847,7 +1847,7 @@ DROGON_TEST(SQLite3Test) { auto result = co_await clientPtr->execSqlCoro("select * from users;"); - MANDATE(result.size() != 0); + MANDATE(result.size() != 0UL); } catch (const DrogonDbException &e) { @@ -1859,7 +1859,7 @@ DROGON_TEST(SQLite3Test) { auto result = co_await clientPtr->execSqlCoro( "select * from users where 1=?;", 1); - MANDATE(result.size() != 0); + MANDATE(result.size() != 0UL); } catch (const DrogonDbException &e) { @@ -1884,7 +1884,7 @@ DROGON_TEST(SQLite3Test) auto mapper = CoroMapper(clientPtr); auto users = co_await mapper.findBy( Criteria(Users::Cols::_id, CompareOperator::EQ, 1)); - MANDATE(users.size() == 1); + MANDATE(users.size() == 1UL); } catch (const DrogonDbException &e) {