|
@ -42,8 +42,7 @@ TEST(Group, all_cases) { |
|
|
for (uint32_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) { |
|
|
for (uint32_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) { |
|
|
pool.submit(build, GroupType(type_id)); |
|
|
pool.submit(build, GroupType(type_id)); |
|
|
} |
|
|
} |
|
|
pool.boot(); |
|
|
pool.boot().join(); // wait data build complete
|
|
|
pool.join(); // wait data build complete
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<CommonCode> combine; |
|
|
std::vector<CommonCode> combine; |
|
|
combine.reserve(ALL_CASES_SIZE_SUM); |
|
|
combine.reserve(ALL_CASES_SIZE_SUM); |
|
@ -60,8 +59,7 @@ TEST(Group, all_cases) { |
|
|
TEST(Group, group_cases) { |
|
|
TEST(Group, group_cases) { |
|
|
auto build = [](CommonCode seed) -> std::vector<CommonCode> { |
|
|
auto build = [](CommonCode seed) -> std::vector<CommonCode> { |
|
|
auto group = Group(seed); |
|
|
auto group = Group(seed); |
|
|
auto tmp = group.cases(); |
|
|
auto cases = CommonCode::convert(group.cases()); // convert as CommonCodes
|
|
|
std::vector<CommonCode> cases(tmp.begin(), tmp.end()); // convert as CommonCodes
|
|
|
|
|
|
EXPECT_EQ(seed, std::min_element(cases.begin(), cases.end())->unwrap()); // confirm min seed
|
|
|
EXPECT_EQ(seed, std::min_element(cases.begin(), cases.end())->unwrap()); // confirm min seed
|
|
|
EXPECT_EQ(cases.size(), group.size()); // verify group size
|
|
|
EXPECT_EQ(cases.size(), group.size()); // verify group size
|
|
|
EXPECT_EQ(seed, group.seed()); // verify group seed
|
|
|
EXPECT_EQ(seed, group.seed()); // verify group seed
|
|
@ -84,8 +82,8 @@ TEST(Group, group_cases) { |
|
|
pool.boot(); |
|
|
pool.boot(); |
|
|
std::vector<CommonCode> all_cases; |
|
|
std::vector<CommonCode> all_cases; |
|
|
all_cases.reserve(ALL_CASES_SIZE_SUM); |
|
|
all_cases.reserve(ALL_CASES_SIZE_SUM); |
|
|
for (auto &&f : futures) { |
|
|
for (auto &&tmp : futures) { |
|
|
auto cases = f.get(); |
|
|
auto cases = tmp.get(); |
|
|
all_cases.insert(all_cases.end(), cases.begin(), cases.end()); // combine build result
|
|
|
all_cases.insert(all_cases.end(), cases.begin(), cases.end()); // combine build result
|
|
|
} |
|
|
} |
|
|
std::sort(all_cases.begin(), all_cases.end()); |
|
|
std::sort(all_cases.begin(), all_cases.end()); |
|
@ -127,8 +125,7 @@ TEST(Group, build_groups) { |
|
|
std::map<uint32_t, std::vector<CommonCode>> group_seeds; // <group_size, group_seeds>
|
|
|
std::map<uint32_t, std::vector<CommonCode>> group_seeds; // <group_size, group_seeds>
|
|
|
|
|
|
|
|
|
for (uint32_t group_id = 0; group_id < groups.size(); ++group_id) { |
|
|
for (uint32_t group_id = 0; group_id < groups.size(); ++group_id) { |
|
|
auto tmp = Group(type_id, group_id).cases(); |
|
|
auto group = CommonCode::convert(Group(type_id, group_id).cases()); |
|
|
std::vector<CommonCode> group(tmp.begin(), tmp.end()); |
|
|
|
|
|
std::sort(group.begin(), group.end()); |
|
|
std::sort(group.begin(), group.end()); |
|
|
std::sort(groups[group_id].begin(), groups[group_id].end()); |
|
|
std::sort(groups[group_id].begin(), groups[group_id].end()); |
|
|
|
|
|
|
|
@ -163,8 +160,7 @@ TEST(Group, build_groups) { |
|
|
for (uint32_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) { |
|
|
for (uint32_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) { |
|
|
pool.submit(test, GroupType(type_id)); |
|
|
pool.submit(test, GroupType(type_id)); |
|
|
} |
|
|
} |
|
|
pool.boot(); |
|
|
pool.boot().join(); |
|
|
pool.join(); |
|
|
|
|
|
|
|
|
|
|
|
char buffer[9]; |
|
|
char buffer[9]; |
|
|
std::string group_info_str; |
|
|
std::string group_info_str; |
|
|