Browse Source

update: multiple enhancements and fixes

legacy
Dnomd343 1 year ago
parent
commit
70a99e5f06
  1. 2
      src/core/CMakeLists.txt
  2. 2
      src/core/all_cases/all_cases.cc
  3. 40
      src/core/all_cases/all_cases.h
  4. 51
      src/core/all_cases/inline_impl.h
  5. 41
      src/core/common_code/sundry.cc
  6. 15
      src/core/main.cc
  7. 8
      src/core/raw_code/convert.cc
  8. 2
      src/core/raw_code/mirror.cc
  9. 24
      src/core/raw_code/sundry.cc
  10. 14
      src/core/short_code/short_code.cc
  11. 1
      src/core/short_code/short_code.h
  12. 48
      src/core/short_code/sundry.cc
  13. 121
      src/core_test/codec/common_code.cc
  14. 36
      src/core_test/codec/sample.h

2
src/core/CMakeLists.txt

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
project(klotski-core VERSION 0.9.1 LANGUAGES CXX)

2
src/core/all_cases/all_cases.cc

@ -88,8 +88,6 @@ void AllCases::build_parallel(Executor &&executor) noexcept {
}
std::vector<std::future<void>> futures;
for (auto head : case_heads()) {
// TODO: using std::move_only_function in C++23
// -> avoid using std::shared_ptr<std::promise<void>>
auto promise = std::make_shared<std::promise<void>>();
futures.emplace_back(promise->get_future());
executor([head, promise = std::move(promise)]() {

40
src/core/all_cases/all_cases.h

@ -89,25 +89,6 @@ private:
static void spawn_ranges(Ranges &ranges, int, int, int, int) noexcept;
};
inline BasicRanges& BasicRanges::instance() noexcept {
static BasicRanges instance;
return instance;
}
inline Ranges& BasicRanges::get_ranges() noexcept {
static Ranges ranges;
return ranges;
}
inline const Ranges& BasicRanges::fetch() noexcept {
this->build();
return get_ranges();
}
inline bool BasicRanges::is_available() const noexcept {
return available_; // no mutex required in one-way state
}
// ----------------------------------------------------------------------------------------- //
class AllCases {
@ -131,26 +112,9 @@ private:
static void build_cases(int head, Ranges &release) noexcept;
};
inline AllCases& AllCases::instance() noexcept {
static AllCases instance;
return instance;
}
inline RangesUnion& AllCases::get_cases() noexcept {
static RangesUnion cases;
return cases;
}
inline const RangesUnion& AllCases::fetch() noexcept {
this->build();
return get_cases();
}
inline bool AllCases::is_available() const noexcept {
return available_; // no mutex required in one-way state
}
// ----------------------------------------------------------------------------------------- //
} // namespace cases
} // namespace klotski
#include "inline_impl.h"

51
src/core/all_cases/inline_impl.h

@ -0,0 +1,51 @@
#pragma once
namespace klotski {
namespace cases {
// ----------------------------------------------------------------------------------------- //
inline BasicRanges& BasicRanges::instance() noexcept {
static BasicRanges instance;
return instance;
}
inline Ranges& BasicRanges::get_ranges() noexcept {
static Ranges ranges;
return ranges;
}
inline const Ranges& BasicRanges::fetch() noexcept {
this->build();
return get_ranges();
}
inline bool BasicRanges::is_available() const noexcept {
return available_; // no mutex required in one-way state
}
// ----------------------------------------------------------------------------------------- //
inline AllCases& AllCases::instance() noexcept {
static AllCases instance;
return instance;
}
inline RangesUnion& AllCases::get_cases() noexcept {
static RangesUnion cases;
return cases;
}
inline const RangesUnion& AllCases::fetch() noexcept {
this->build();
return get_cases();
}
inline bool AllCases::is_available() const noexcept {
return available_; // no mutex required in one-way state
}
// ----------------------------------------------------------------------------------------- //
} // namespace codec
} // namespace klotski

41
src/core/common_code/sundry.cc

@ -39,11 +39,9 @@ std::optional<CommonCode> CommonCode::from_string(std::string &&common_code) noe
}
std::optional<CommonCode> CommonCode::from_string(const std::string &common_code) noexcept {
auto code = string_decode(common_code);
if (!code.has_value()) {
return std::nullopt; // invalid string
}
return CommonCode::unsafe_create(code.value());
return string_decode(common_code).transform([](auto code) {
return CommonCode::unsafe_create(code);
});
}
// ----------------------------------------------------------------------------------------- //
@ -52,13 +50,10 @@ CommonCode CommonCode::from_raw_code(RawCode raw_code) noexcept {
return raw_code.to_common_code();
}
// TODO: using `std::optional::transform` in C++23
std::optional<CommonCode> CommonCode::from_raw_code(uint64_t raw_code) noexcept {
auto code = RawCode::create(raw_code);
if (!code.has_value()) {
return std::nullopt; // invalid raw code
}
return code->to_common_code();
return RawCode::create(raw_code).transform([](auto raw_code) {
return raw_code.to_common_code();
});
}
// ----------------------------------------------------------------------------------------- //
@ -68,27 +63,21 @@ CommonCode CommonCode::from_short_code(ShortCode short_code) noexcept {
}
std::optional<CommonCode> CommonCode::from_short_code(uint32_t short_code) noexcept {
auto code = ShortCode::create(short_code);
if (!code.has_value()) {
return std::nullopt; // invalid short code
}
return code->to_common_code();
return ShortCode::create(short_code).transform([](auto short_code) {
return short_code.to_common_code();
});
}
std::optional<CommonCode> CommonCode::from_short_code(std::string &&short_code) noexcept {
auto code = ShortCode::from_string(std::move(short_code));
if (!code.has_value()) {
return std::nullopt; // invalid short code
}
return code->to_common_code();
return ShortCode::from_string(std::move(short_code)).transform([](auto short_code) {
return short_code.to_common_code();
});
}
std::optional<CommonCode> CommonCode::from_short_code(const std::string &short_code) noexcept {
auto code = ShortCode::from_string(short_code);
if (!code.has_value()) {
return std::nullopt; // invalid short code
}
return code->to_common_code();
return ShortCode::from_string(short_code).transform([](auto short_code) {
return short_code.to_common_code();
});
}
// ----------------------------------------------------------------------------------------- //

15
src/core/main.cc

@ -1,4 +1,7 @@
#include <thread>
#include <iostream>
#include <algorithm>
#include "raw_code.h"
#include "all_cases.h"
#include "short_code.h"
@ -11,10 +14,12 @@ using klotski::codec::RawCode;
using klotski::codec::ShortCode;
using klotski::codec::CommonCode;
using klotski::codec::SHORT_CODE_LIMIT;
int main() {
// AllCases::instance().build();
BasicRanges::instance().build();
AllCases::instance().build();
// BasicRanges::instance().build();
// std::vector<uint64_t> common_codes;
// common_codes.reserve(klotski::cases::ALL_CASES_NUM_);
@ -31,8 +36,14 @@ int main() {
// common_codes_str.emplace_back(CommonCode::string_encode(x, false));
// }
ShortCode::speed_up(true);
auto start = clock();
for (uint32_t short_code = 0; short_code < SHORT_CODE_LIMIT; ++short_code) {
ShortCode::unsafe_create(short_code).to_common_code(true);
}
// for (auto common_code : common_codes) {
// printf("%llX\n", common_code);
// CommonCode::string_encode(common_code, true);

8
src/core/raw_code/convert.cc

@ -5,8 +5,8 @@
namespace klotski {
namespace codec {
/// NOTE: ensure that input raw code is valid!
uint64_t RawCode::compact(uint64_t raw_code) noexcept { // raw code --> common code
/// Convert RawCode to CommonCode.
uint64_t RawCode::compact(uint64_t raw_code) noexcept {
int unfilled = 16;
uint64_t head = 0; // 2x2 block address
uint32_t range = 0;
@ -34,8 +34,8 @@ uint64_t RawCode::compact(uint64_t raw_code) noexcept { // raw code --> common c
return head | (range << (unfilled << 1)); // fill low bits as zero
}
/// NOTE: ensure that input common code is valid!
uint64_t RawCode::extract(uint64_t common_code) noexcept { // common code --> raw code
/// Convert CommonCode to RawCode.
uint64_t RawCode::extract(uint64_t common_code) noexcept {
auto code = K_MASK_2x2 << (common_code >> 32) * 3; // flag for 2x2 block
auto range = range_reverse((uint32_t)common_code); // reversed range

2
src/core/raw_code/mirror.cc

@ -116,5 +116,7 @@ bool RawCode::check_horizontal_mirror(uint64_t raw_code) noexcept {
&& !(MASK_MIRROR_H2 & ((raw_code >> 3) ^ raw_code));
}
// ----------------------------------------------------------------------------------------- //
} // namespace codec
} // namespace klotski

24
src/core/raw_code/sundry.cc

@ -23,27 +23,21 @@ RawCode RawCode::from_common_code(CommonCode common_code) noexcept {
}
std::optional<RawCode> RawCode::from_common_code(uint64_t common_code) noexcept {
auto code = CommonCode::create(common_code);
if (!code.has_value()) {
return std::nullopt; // invalid common code
}
return code->to_raw_code();
return CommonCode::create(common_code).transform([](auto common_code) {
return common_code.to_raw_code();
});
}
std::optional<RawCode> RawCode::from_common_code(std::string &&common_code) noexcept {
auto code = CommonCode::from_string(std::move(common_code));
if (!code.has_value()) {
return std::nullopt; // invalid common code
}
return code->to_raw_code();
return CommonCode::from_short_code(std::move(common_code)).transform([](auto common_code) {
return common_code.to_raw_code();
});
}
std::optional<RawCode> RawCode::from_common_code(const std::string &common_code) noexcept {
auto code = CommonCode::from_string(common_code);
if (!code.has_value()) {
return std::nullopt; // invalid common code
}
return code->to_raw_code();
return CommonCode::from_string(common_code).transform([](auto common_code) {
return common_code.to_raw_code();
});
}
// ----------------------------------------------------------------------------------------- //

14
src/core/short_code/short_code.cc

@ -18,21 +18,7 @@ void ShortCode::speed_up(bool fast_mode) noexcept {
} else {
BasicRanges::instance().build();
}
// FIXME: setting up `fast_available_`
}
//void ShortCode::speed_up(ShortCode::Mode mode) {
// if (fast_mode_available_) {
// return; // fast mode already available
// }
// if (mode == ShortCode::FAST) { // build fast mode data
// AllCases::build(); // blocking function
// fast_mode_available_ = true;
// } else if (!normal_mode_available_) { // build normal mode data
// BasicRanges::build(); // blocking function
// normal_mode_available_ = true;
// }
//}
} // namespace codec
} // namespace klotski

1
src/core/short_code/short_code.h

@ -106,7 +106,6 @@ public:
private:
uint32_t code_;
static bool fast_available_; // TODO: try to remove it
static uint64_t fast_decode(uint32_t short_code) noexcept;
static uint32_t fast_encode(uint64_t common_code) noexcept;

48
src/core/short_code/sundry.cc

@ -1,17 +1,19 @@
#include "short_code.h"
#include "common_code.h"
using klotski::cases::AllCases;
namespace klotski {
namespace codec {
// ----------------------------------------------------------------------------------------- //
ShortCode::ShortCode(CommonCode common_code) noexcept {
// if (fast_available_) {
if (AllCases::instance().is_available()) {
code_ = fast_encode(common_code.unwrap());
// } else {
// code_ = tiny_encode(common_code.unwrap());
// }
} else {
code_ = tiny_encode(common_code.unwrap());
}
}
// ----------------------------------------------------------------------------------------- //
@ -21,10 +23,10 @@ std::string ShortCode::to_string() const noexcept {
}
CommonCode ShortCode::to_common_code() const noexcept {
// if (fast_available_) {
if (AllCases::instance().is_available()) {
return CommonCode::unsafe_create(fast_decode(code_));
// }
// return CommonCode::unsafe_create(tiny_decode(code_));
}
return CommonCode::unsafe_create(tiny_decode(code_));
}
// ----------------------------------------------------------------------------------------- //
@ -34,11 +36,9 @@ std::optional<ShortCode> ShortCode::from_string(std::string &&short_code) noexce
}
std::optional<ShortCode> ShortCode::from_string(const std::string &short_code) noexcept {
auto code = ShortCode::string_decode(short_code);
if (!code.has_value()) {
return std::nullopt; // invalid string
}
return ShortCode::unsafe_create(code.value());
return ShortCode::string_decode(short_code).transform([](auto code) {
return ShortCode::unsafe_create(code);
});
}
// ----------------------------------------------------------------------------------------- //
@ -48,27 +48,21 @@ ShortCode ShortCode::from_common_code(CommonCode common_code) noexcept {
}
std::optional<ShortCode> ShortCode::from_common_code(uint64_t common_code) noexcept {
auto code = CommonCode::create(common_code);
if (!code.has_value()) {
return std::nullopt; // invalid common code
}
return code->to_short_code();
return CommonCode::create(common_code).transform([](auto common_code) {
return common_code.to_short_code();
});
}
std::optional<ShortCode> ShortCode::from_common_code(std::string &&common_code) noexcept {
auto code = CommonCode::from_string(std::move(common_code));
if (!code.has_value()) {
return std::nullopt; // invalid common code
}
return code->to_short_code();
return CommonCode::from_string(std::move(common_code)).transform([](auto common_code) {
return common_code.to_short_code();
});
}
std::optional<ShortCode> ShortCode::from_common_code(const std::string &common_code) noexcept {
auto code = CommonCode::from_string(common_code);
if (!code.has_value()) {
return std::nullopt; // invalid common code
}
return code->to_short_code();
return CommonCode::from_string(common_code).transform([](auto common_code) {
return common_code.to_short_code();
});
}
// ----------------------------------------------------------------------------------------- //

121
src/core_test/codec/common_code.cc

@ -1,5 +1,6 @@
#include <algorithm>
#include "sample.h"
#include "all_cases.h"
#include "raw_code.h"
#include "short_code.h"
@ -14,9 +15,6 @@ using klotski::codec::CommonCode;
using klotski::cases::AllCases;
using klotski::cases::ALL_CASES_NUM_;
const static uint64_t TEST_CODE = 0x1'A9BF'0C00;
const static std::string TEST_CODE_STR = "1A9BF0C00";
TEST(CommonCode, validity) {
EXPECT_NE(CommonCode::check(0x3'A9'BF'0C'00), true); // invalid 2x2 block
EXPECT_NE(CommonCode::check(0x1'D9'BF'0C'00), true); // invalid block range
@ -29,23 +27,76 @@ TEST(CommonCode, validity) {
}
TEST(CommonCode, operators) {
auto common_code = CommonCode::create(TEST_CODE).value();
auto common_code = CommonCode::create(TEST_C_CODE).value();
std::ostringstream tmp;
tmp << common_code; // ostream capture
EXPECT_EQ(tmp.str(), TEST_CODE_STR);
EXPECT_EQ((uint64_t)common_code, TEST_CODE); // convert as uint64_t
EXPECT_EQ(tmp.str(), TEST_C_CODE_STR);
EXPECT_EQ((uint64_t)common_code, TEST_C_CODE); // convert as uint64_t
EXPECT_EQ(TEST_CODE, common_code); // uint64_t == CommonCode
EXPECT_EQ(common_code, TEST_CODE); // CommonCode == uint64_t
EXPECT_EQ(TEST_C_CODE, common_code); // uint64_t == CommonCode
EXPECT_EQ(common_code, TEST_C_CODE); // CommonCode == uint64_t
EXPECT_EQ(common_code, common_code); // CommonCode == CommonCode
EXPECT_NE(TEST_CODE + 1, common_code); // uint64_t != CommonCode
EXPECT_NE(common_code, TEST_CODE + 1); // CommonCode != uint64_t
EXPECT_NE(common_code, CommonCode::unsafe_create(TEST_CODE + 1)); // CommonCode != CommonCode
EXPECT_NE(TEST_C_CODE + 1, common_code); // uint64_t != CommonCode
EXPECT_NE(common_code, TEST_C_CODE + 1); // CommonCode != uint64_t
EXPECT_NE(common_code, CommonCode::unsafe_create(TEST_C_CODE + 1)); // CommonCode != CommonCode
EXPECT_LT(common_code, CommonCode::unsafe_create(TEST_C_CODE + 1)); // CommonCode < CommonCode
EXPECT_GT(CommonCode::unsafe_create(TEST_C_CODE + 1), common_code); // CommonCode > CommonCode
}
TEST(CommonCode, initializate) {
auto raw_code = RawCode::unsafe_create(TEST_R_CODE);
auto short_code = ShortCode::unsafe_create(TEST_S_CODE);
// CommonCode(...)
EXPECT_EQ(CommonCode(raw_code), TEST_C_CODE);
EXPECT_EQ(CommonCode(short_code), TEST_C_CODE);
// CommonCode::create(uint64_t)
EXPECT_TRUE(CommonCode::create(TEST_C_CODE).has_value());
EXPECT_FALSE(CommonCode::create(TEST_C_CODE_ERR).has_value());
EXPECT_EQ(CommonCode::create(TEST_C_CODE), TEST_C_CODE);
// CommonCode::unsafe_create(uint64_t)
EXPECT_EQ(CommonCode::unsafe_create(TEST_C_CODE), TEST_C_CODE);
// CommonCode::from_string(const std::string &)
EXPECT_TRUE(CommonCode::from_string(TEST_C_CODE_STR).has_value());
EXPECT_FALSE(CommonCode::from_string(TEST_C_CODE_STR_ERR).has_value());
EXPECT_EQ(CommonCode::from_string(TEST_C_CODE_STR), TEST_C_CODE);
EXPECT_LT(common_code, CommonCode::unsafe_create(TEST_CODE + 1)); // CommonCode < CommonCode
EXPECT_GT(CommonCode::unsafe_create(TEST_CODE + 1), common_code); // CommonCode > CommonCode
// CommonCode::from_string(std::string &&)
EXPECT_TRUE(CommonCode::from_string(TEST_C_CODE_STR_RV).has_value());
EXPECT_FALSE(CommonCode::from_string(TEST_C_CODE_STR_ERR_RV).has_value());
EXPECT_EQ(CommonCode::from_string(TEST_C_CODE_STR_RV), TEST_C_CODE);
// CommonCode::from_raw_code(RawCode)
EXPECT_EQ(CommonCode::from_raw_code(raw_code), TEST_C_CODE);
// CommonCode::from_raw_code(uint64_t)
EXPECT_TRUE(CommonCode::from_raw_code(TEST_R_CODE).has_value());
EXPECT_FALSE(CommonCode::from_raw_code(TEST_R_CODE_ERR).has_value());
EXPECT_EQ(CommonCode::from_raw_code(TEST_R_CODE), TEST_C_CODE);
// CommonCode::from_short_code(ShortCode)
EXPECT_EQ(CommonCode::from_short_code(short_code), TEST_C_CODE);
// CommonCode::from_short_code(uint32_t)
EXPECT_TRUE(CommonCode::from_short_code(TEST_S_CODE).has_value());
EXPECT_FALSE(CommonCode::from_short_code(TEST_S_CODE_ERR).has_value());
EXPECT_EQ(CommonCode::from_short_code(TEST_S_CODE), TEST_C_CODE);
// CommonCode::from_short_code(const std::string &)
EXPECT_TRUE(CommonCode::from_short_code(TEST_S_CODE_STR).has_value());
EXPECT_FALSE(CommonCode::from_short_code(TEST_S_CODE_STR_ERR).has_value());
EXPECT_EQ(CommonCode::from_short_code(TEST_S_CODE_STR), TEST_C_CODE);
// CommonCode::from_short_code(std::string &&)
EXPECT_TRUE(CommonCode::from_short_code(TEST_S_CODE_STR_RV).has_value());
EXPECT_FALSE(CommonCode::from_short_code(TEST_S_CODE_STR_ERR_RV).has_value());
EXPECT_EQ(CommonCode::from_short_code(TEST_S_CODE_STR_RV), TEST_C_CODE);
}
TEST(CommonCode, code_verify) {
@ -54,7 +105,7 @@ TEST(CommonCode, code_verify) {
pool.push_task([](uint64_t head) {
for (auto range : AllCases::instance().fetch()[head]) {
auto code = head << 32 | range;
EXPECT_TRUE(CommonCode::check(code)); // verify all valid code
EXPECT_TRUE(CommonCode::check(code)); // verify all cases
}
}, head);
}
@ -97,11 +148,11 @@ TEST(CommonCode, code_string) {
}
TEST(CommonCode, code_convert) {
auto common_code = CommonCode::create(TEST_CODE).value();
EXPECT_EQ(common_code.unwrap(), TEST_CODE);
EXPECT_EQ(common_code.to_string(), TEST_CODE_STR);
EXPECT_EQ(common_code.to_raw_code(), RawCode(common_code));
EXPECT_EQ(common_code.to_short_code(), ShortCode(common_code));
auto common_code = CommonCode::unsafe_create(TEST_C_CODE);
EXPECT_EQ(common_code.unwrap(), TEST_C_CODE);
EXPECT_EQ(common_code.to_string(), TEST_C_CODE_STR);
EXPECT_EQ(common_code.to_raw_code(), TEST_R_CODE);
EXPECT_EQ(common_code.to_short_code(), TEST_S_CODE);
auto code_shorten = common_code.to_string(true);
EXPECT_EQ(CommonCode::from_string(code_shorten), common_code); // l-value
@ -112,38 +163,6 @@ TEST(CommonCode, code_convert) {
EXPECT_EQ(CommonCode::from_string(std::move(code_normal)), common_code); // r-value
}
TEST(CommonCode, initializate) {
EXPECT_TRUE(CommonCode::create(TEST_CODE).has_value());
EXPECT_EQ(CommonCode::create(TEST_CODE), TEST_CODE);
EXPECT_EQ(CommonCode::unsafe_create(TEST_CODE), TEST_CODE);
auto common_code = CommonCode::create(TEST_CODE).value();
EXPECT_EQ(CommonCode(RawCode(common_code)), TEST_CODE);
EXPECT_EQ(CommonCode(ShortCode(common_code)), TEST_CODE);
EXPECT_TRUE(CommonCode::from_string(TEST_CODE_STR).has_value());
EXPECT_EQ(CommonCode::from_string(TEST_CODE_STR), TEST_CODE); // l-value
EXPECT_EQ(CommonCode::from_string(std::string(TEST_CODE_STR)), TEST_CODE); // r-value
auto raw_code = RawCode(common_code);
auto raw_code_val = raw_code.unwrap();
EXPECT_EQ(CommonCode::from_raw_code(raw_code), TEST_CODE);
EXPECT_TRUE(CommonCode::from_raw_code(raw_code_val).has_value());
EXPECT_EQ(CommonCode::from_raw_code(raw_code_val), TEST_CODE);
auto short_code = ShortCode(common_code);
auto short_code_val = short_code.unwrap();
auto short_code_str = short_code.to_string();
EXPECT_TRUE(CommonCode::from_short_code(short_code_val).has_value());
EXPECT_TRUE(CommonCode::from_short_code(short_code_str).has_value());
EXPECT_TRUE(CommonCode::from_short_code(std::string(short_code_str)).has_value());
EXPECT_EQ(CommonCode::from_short_code(short_code_val), TEST_CODE);
EXPECT_EQ(CommonCode::from_short_code(short_code), TEST_CODE);
EXPECT_EQ(CommonCode::from_short_code(short_code_str), TEST_CODE); // l-value
EXPECT_EQ(CommonCode::from_short_code(std::string(short_code_str)), TEST_CODE); // r-value
}
TEST(CommonCode, DISABLED_global) {
std::vector<uint64_t> common_codes;
common_codes.reserve(ALL_CASES_NUM_);

36
src/core_test/codec/sample.h

@ -0,0 +1,36 @@
#pragma once
#include <string>
#include <cstdint>
// ----------------------------------------------------------------------------------------- //
// Valid RawCode
const uint64_t TEST_R_CODE = 0x0603'EDF5'CAFF'F5E2;
// Valid ShortCode
const uint32_t TEST_S_CODE = 4091296;
const std::string TEST_S_CODE_STR = "4WVE1";
#define TEST_S_CODE_STR_RV std::string(TEST_S_CODE_STR) // r-value
// Valid CommonCode
const uint64_t TEST_C_CODE = 0x1'A9BF'0C00;
const std::string TEST_C_CODE_STR = "1A9BF0C00";
#define TEST_C_CODE_STR_RV std::string(TEST_C_CODE_STR) // r-value
// ----------------------------------------------------------------------------------------- //
// Invalid RawCode
const static uint64_t TEST_R_CODE_ERR = 0x1603'ED00'CAFF'F5E2;
// Invalid ShortCode
const static uint32_t TEST_S_CODE_ERR = 1234564323;
const static std::string TEST_S_CODE_STR_ERR = "ZZZZZZ";
#define TEST_S_CODE_STR_ERR_RV std::string(TEST_S_CODE_STR_ERR) // r-value
// Invalid CommonCode
const static uint64_t TEST_C_CODE_ERR = 0x3'A9BF'0C00;
const static std::string TEST_C_CODE_STR_ERR = "0123456789";
#define TEST_C_CODE_STR_ERR_RV std::string(TEST_C_CODE_STR_ERR) // r-value
// ----------------------------------------------------------------------------------------- //
Loading…
Cancel
Save