Fix compiler warnings (#886)
Co-authored-by: an-tao <antao2002@gmail.com> Co-authored-by: Martin Chang <marty1885@users.noreply.github.com>
This commit is contained in:
parent
e7ec973095
commit
a70a2844b1
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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<CaseBase> 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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#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::Case> 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::Case> 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::Case> 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::Case> 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::Case> 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::Case> 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::Case> 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);
|
||||
});
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<int32_t>{2, 200}),
|
||||
[TEST_CTX](std::vector<Users> users) { MANDATE(users.size() == 1); },
|
||||
[TEST_CTX](std::vector<Users> 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<Users>(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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue