|
@ -17,17 +17,11 @@ std::vector<uint64_t> short_code_check(uint32_t start, uint32_t end) { |
|
|
return archive; |
|
|
return archive; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TEST(GLOBAL, short_code) { |
|
|
void short_code_verify() { |
|
|
/// create short code check tasks
|
|
|
/// create short code check tasks
|
|
|
auto pool = TinyPool(thread_num()); |
|
|
auto pool = TinyPool(thread_num()); |
|
|
ShortCode::speed_up(ShortCode::NORMAL); |
|
|
|
|
|
std::vector<std::future<std::vector<uint64_t>>> futures; |
|
|
std::vector<std::future<std::vector<uint64_t>>> futures; |
|
|
|
|
|
|
|
|
for (const auto &range : range_split(0, klotski::ALL_CASES_SIZE_SUM, 10000)) { |
|
|
for (const auto &range : range_split(0, klotski::ALL_CASES_SIZE_SUM, 10000)) { |
|
|
// for (const auto &range : range_split(0, 80000, 10000)) {
|
|
|
|
|
|
|
|
|
|
|
|
// std::cout << "[" << range.first << ", " << range.second << ")" << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
futures.emplace_back( |
|
|
futures.emplace_back( |
|
|
pool.submit(short_code_check, range.first, range.second) |
|
|
pool.submit(short_code_check, range.first, range.second) |
|
|
); |
|
|
); |
|
@ -42,8 +36,6 @@ TEST(GLOBAL, short_code) { |
|
|
} |
|
|
} |
|
|
pool.join(); |
|
|
pool.join(); |
|
|
|
|
|
|
|
|
// std::cout << result.size() << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
/// verify check result
|
|
|
/// verify check result
|
|
|
std::vector<uint64_t> all_cases; |
|
|
std::vector<uint64_t> all_cases; |
|
|
for (uint64_t head = 0; head < 16; ++head) { |
|
|
for (uint64_t head = 0; head < 16; ++head) { |
|
@ -52,5 +44,12 @@ TEST(GLOBAL, short_code) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
EXPECT_EQ(result, all_cases); |
|
|
EXPECT_EQ(result, all_cases); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TEST(GLOBAL, short_code) { |
|
|
|
|
|
ShortCode::speed_up(ShortCode::NORMAL); // normal mode
|
|
|
|
|
|
short_code_verify(); |
|
|
|
|
|
|
|
|
|
|
|
ShortCode::speed_up(ShortCode::FAST); // fast mode
|
|
|
|
|
|
short_code_verify(); |
|
|
} |
|
|
} |
|
|