Skip to content

Commit

Permalink
Fix clang tidy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sjanel committed Aug 10, 2023
1 parent b240e12 commit cb391a0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/api/exchanges/test/bithumb_place_order_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/objects/src/logginginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions src/tech/src/codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ string B64Decode(std::span<const char> ascData) {
string URLEncode(std::span<const char> 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<unsigned char>(c));
sprintf_s(outCharIt, 4, "%%%02X", static_cast<unsigned char>(ch));
#else
std::sprintf(outCharIt, "%%%02X", static_cast<unsigned char>(c));
std::sprintf(outCharIt, "%%%02X", static_cast<unsigned char>(ch));
#endif
outCharIt += 3;
}
Expand Down
30 changes: 15 additions & 15 deletions src/tech/test/timestring_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cb391a0

Please sign in to comment.