|
@ -1,5 +1,9 @@ |
|
|
#include "hash.h" |
|
|
#include "hash.h" |
|
|
#include "helper.h" |
|
|
#include "helper.h" |
|
|
|
|
|
#include "group/group.h" |
|
|
|
|
|
|
|
|
|
|
|
using klotski::cases::Ranges; |
|
|
|
|
|
using klotski::cases::BLOCK_NUM; |
|
|
|
|
|
|
|
|
static constexpr uint64_t BASIC_RANGES_XXH3 = 0x34fce9da6a052533; |
|
|
static constexpr uint64_t BASIC_RANGES_XXH3 = 0x34fce9da6a052533; |
|
|
|
|
|
|
|
@ -28,9 +32,28 @@ protected: |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
TEST_FF(BasicRanges, content) { |
|
|
|
|
|
auto &ranges = BasicRanges::instance().fetch(); |
|
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(std::ranges::is_sorted(ranges.begin(), ranges.end())); |
|
|
|
|
|
const auto match = std::ranges::adjacent_find(ranges.begin(), ranges.end()); |
|
|
|
|
|
EXPECT_EQ(match, ranges.end()); // no duplicates
|
|
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(ranges.size(), BASIC_RANGES_NUM_); // size verify
|
|
|
|
|
|
EXPECT_EQ(hash::xxh3(ranges), BASIC_RANGES_XXH3); // checksum verify
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
TEST_FF(BasicRanges, constant) { |
|
|
TEST_FF(BasicRanges, constant) { |
|
|
// TODO: check BASIC_RANGES_NUM array
|
|
|
|
|
|
EXPECT_EQ(BASIC_RANGES_NUM_, 7311885); |
|
|
EXPECT_EQ(BASIC_RANGES_NUM_, 7311885); |
|
|
|
|
|
EXPECT_EQ(array_sum(BASIC_RANGES_NUM), BASIC_RANGES_NUM_); |
|
|
|
|
|
|
|
|
|
|
|
Ranges ranges; |
|
|
|
|
|
for (uint32_t type_id = 0; type_id < klotski::cases::TYPE_ID_LIMIT; ++type_id) { |
|
|
|
|
|
auto [n, n_2x1, n_1x1] = BLOCK_NUM[type_id]; |
|
|
|
|
|
ranges.clear(); |
|
|
|
|
|
ranges.spawn(n, n_2x1, n_1x1); |
|
|
|
|
|
EXPECT_EQ(ranges.size(), BASIC_RANGES_NUM[type_id]); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TEST_FF(BasicRanges, basic_ranges) { |
|
|
TEST_FF(BasicRanges, basic_ranges) { |
|
|