|
@ -1,14 +1,20 @@ |
|
|
#include <thread> |
|
|
#include <thread> |
|
|
|
|
|
#include <algorithm> |
|
|
#include "md5.h" |
|
|
#include "md5.h" |
|
|
#include "group.h" |
|
|
#include "group.h" |
|
|
#include "gtest/gtest.h" |
|
|
#include "gtest/gtest.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "group/size.h" |
|
|
|
|
|
|
|
|
using klotski::Group; |
|
|
using klotski::Group; |
|
|
using klotski::AllCases; |
|
|
using klotski::AllCases; |
|
|
using klotski::CommonCode; |
|
|
using klotski::CommonCode; |
|
|
|
|
|
|
|
|
using klotski::TYPE_ID_LIMIT; |
|
|
using klotski::TYPE_ID_LIMIT; |
|
|
using klotski::ALL_CASES_SIZE_SUM; |
|
|
using klotski::ALL_CASES_SIZE_SUM; |
|
|
|
|
|
using klotski::GROUP_ALL_CASES_SIZE; |
|
|
|
|
|
|
|
|
|
|
|
using klotski::TYPE_ID_LIMIT; |
|
|
|
|
|
|
|
|
const char BLOCK_NUM_MD5[] = "46a7b3af6d039cbe2f7eaebdd196c6a2"; |
|
|
const char BLOCK_NUM_MD5[] = "46a7b3af6d039cbe2f7eaebdd196c6a2"; |
|
|
|
|
|
|
|
@ -62,10 +68,26 @@ TEST(Group, block_num) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TEST(Group, all_cases) { |
|
|
TEST(Group, all_cases) { |
|
|
|
|
|
std::vector<std::vector<CommonCode>> all_cases; |
|
|
|
|
|
for (uint32_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) { |
|
|
|
|
|
all_cases.emplace_back(Group::all_cases(type_id)); // build test data
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// TODO: all_cases number
|
|
|
std::vector<uint64_t> combine_cases; |
|
|
// TODO: combine test
|
|
|
combine_cases.reserve(ALL_CASES_SIZE_SUM); |
|
|
// TODO: data order
|
|
|
for (uint32_t id = 0; id < TYPE_ID_LIMIT; ++id) { |
|
|
// TODO: test every cases (type_id)
|
|
|
EXPECT_EQ(all_cases[id].size(), GROUP_ALL_CASES_SIZE[id]); // verify cases number
|
|
|
|
|
|
for (auto &&common_code : all_cases[id]) { |
|
|
|
|
|
EXPECT_EQ(Group::type_id(common_code), id); // verify type id
|
|
|
|
|
|
combine_cases.emplace_back(common_code.unwrap()); |
|
|
|
|
|
} |
|
|
|
|
|
std::is_sorted(all_cases[id].begin(), all_cases[id].end()); // verify data order
|
|
|
|
|
|
} |
|
|
|
|
|
EXPECT_EQ(combine_cases.size(), ALL_CASES_SIZE_SUM); // verify sum
|
|
|
|
|
|
|
|
|
|
|
|
auto all_cases_release = AllCases::release(); |
|
|
|
|
|
std::stable_sort(combine_cases.begin(), combine_cases.end()); |
|
|
|
|
|
for (uint32_t i = 0; i < combine_cases.size(); ++i) { |
|
|
|
|
|
EXPECT_EQ(combine_cases[i], all_cases_release[i]); // verify after combined
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|