diff --git a/src/api/exchanges/test/bithumb_place_order_test.cpp b/src/api/exchanges/test/bithumb_place_order_test.cpp index f6ffa961..3bb20abb 100644 --- a/src/api/exchanges/test/bithumb_place_order_test.cpp +++ b/src/api/exchanges/test/bithumb_place_order_test.cpp @@ -41,14 +41,14 @@ TEST_F(BithumbPrivateAPIPlaceOrderTest, PlaceOrderShortenDecimals) { {/// Place order, with high number of decimals {"/trade/" "place?endpoint=%2Ftrade%2Fplace&order_currency=ETH&payment_currency=EUR&type=ask&price=1500&units=2.000001", - "{\"status\": \"5600\", \"message\":\"수량은 소수점 4자\"}"}, + R"({"status": "5600", "message":"수량은 소수점 4자"})"}, /// Replace order with decimals correctly truncated {"/trade/" "place?endpoint=%2Ftrade%2Fplace&order_currency=ETH&payment_currency=EUR&type=ask&price=1500&units=2", - "{\"status\": \"0000\", \"order_id\": \"ID0001\"}"}, + R"({"status": "0000", "order_id": "ID0001"})"}, /// Query once order info, order not matched {"/info/orders?endpoint=%2Finfo%2Forders&order_currency=ETH&payment_currency=EUR&type=ask&order_id=ID0001", - "{\"status\": \"0000\", \"data\": [{\"order_id\": \"ID0001\"}]}"}}); + R"({"status": "0000", "data": [{"order_id": "ID0001"}]})"}}); PlaceOrderInfo placeOrderInfo = placeOrder(MonetaryAmount("2.000001ETH"), MonetaryAmount("1500EUR"), TradeSide::kSell); @@ -60,7 +60,7 @@ TEST_F(BithumbPrivateAPIPlaceOrderTest, NoPlaceOrderTooSmallAmount) { {/// Place order, with high number of decimals {"/trade/" "place?endpoint=%2Ftrade%2Fplace&order_currency=ETH&payment_currency=EUR&type=ask&price=1500&units=0.000001", - "{\"status\": \"5600\", \"message\":\"수량은 소수점 4자\"}"}}); + R"({"status": "5600", "message":"수량은 소수점 4자"})"}}); PlaceOrderInfo placeOrderInfo = placeOrder(MonetaryAmount("0.000001ETH"), MonetaryAmount("1500EUR"), TradeSide::kSell); diff --git a/src/objects/src/logginginfo.cpp b/src/objects/src/logginginfo.cpp index f36574fb..47c106dd 100644 --- a/src/objects/src/logginginfo.cpp +++ b/src/objects/src/logginginfo.cpp @@ -103,7 +103,7 @@ File LoggingInfo::getActivityFile() const { string activityFileName("activity_history_"); activityFileName.append(ToString(Clock::now(), _dateFormatStrActivityFiles.data())); activityFileName.append(".txt"); - return File(_dataDir, File::Type::kLog, activityFileName, File::IfError::kThrow); + return {_dataDir, File::Type::kLog, activityFileName, File::IfError::kThrow}; } void LoggingInfo::createLoggers() { diff --git a/src/tech/src/codec.cpp b/src/tech/src/codec.cpp index 941a7292..0e878d19 100644 --- a/src/tech/src/codec.cpp +++ b/src/tech/src/codec.cpp @@ -77,14 +77,14 @@ string B64Decode(std::span ascData) { string URLEncode(std::span ascData) { string ret(3U * ascData.size(), '\0'); char* outCharIt = ret.data(); - for (char c : ascData) { - if (isalnum(c) || c == '-' || c == '.' || c == '_' || c == '~') { - *outCharIt++ = c; + for (char ch : ascData) { + if (isalnum(ch) || ch == '-' || ch == '.' || ch == '_' || ch == '~') { + *outCharIt++ = ch; } else { #ifdef CCT_MSVC - sprintf_s(outCharIt, 4, "%%%02X", static_cast(c)); + sprintf_s(outCharIt, 4, "%%%02X", static_cast(ch)); #else - std::sprintf(outCharIt, "%%%02X", static_cast(c)); + std::sprintf(outCharIt, "%%%02X", static_cast(ch)); #endif outCharIt += 3; } diff --git a/src/tech/test/timestring_test.cpp b/src/tech/test/timestring_test.cpp index 180a34f5..f255502b 100644 --- a/src/tech/test/timestring_test.cpp +++ b/src/tech/test/timestring_test.cpp @@ -37,21 +37,21 @@ TEST(TimeStringTest, LiteralDate) { } TEST(TimeStringTest, ToString) { - TimePoint p{}; - p += std::chrono::years(15); - p += std::chrono::months(9); - p += std::chrono::days(25); - - EXPECT_EQ(ToString(p, "%Y"), "1985"); - EXPECT_EQ(ToString(p, "%Y-%m"), "1985-10"); - EXPECT_EQ(ToString(p, "%Y-%m-%d"), "1985-10-26"); - EXPECT_EQ(ToString(p, "%Y-%m-%d %H"), "1985-10-26 13"); - EXPECT_EQ(ToString(p, "%Y-%m-%d %H:%M"), "1985-10-26 13:39"); - EXPECT_EQ(ToString(p, "%Y-%m-%d %H:%M:%S"), "1985-10-26 13:39:54"); - EXPECT_EQ(ToString(p, "%Y-%m-%d W%U %H:%M:%S"), "1985-10-26 W42 13:39:54"); - - EXPECT_EQ(ToString(p, "%D - %T"), "10/26/85 - 13:39:54"); - EXPECT_EQ(ToString(p, "%D custom string %T"), "10/26/85 custom string 13:39:54"); + TimePoint tp{}; + tp += std::chrono::years(15); + tp += std::chrono::months(9); + tp += std::chrono::days(25); + + EXPECT_EQ(ToString(tp, "%Y"), "1985"); + EXPECT_EQ(ToString(tp, "%Y-%m"), "1985-10"); + EXPECT_EQ(ToString(tp, "%Y-%m-%d"), "1985-10-26"); + EXPECT_EQ(ToString(tp, "%Y-%m-%d %H"), "1985-10-26 13"); + EXPECT_EQ(ToString(tp, "%Y-%m-%d %H:%M"), "1985-10-26 13:39"); + EXPECT_EQ(ToString(tp, "%Y-%m-%d %H:%M:%S"), "1985-10-26 13:39:54"); + EXPECT_EQ(ToString(tp, "%Y-%m-%d W%U %H:%M:%S"), "1985-10-26 W42 13:39:54"); + + EXPECT_EQ(ToString(tp, "%D - %T"), "10/26/85 - 13:39:54"); + EXPECT_EQ(ToString(tp, "%D custom string %T"), "10/26/85 custom string 13:39:54"); } TEST(TimeStringTest, FromToString) {