|
|
@ -30,36 +30,39 @@ int main() { |
|
|
|
// printf("%09lX\n", s.unzip_short_code(14323231));
|
|
|
|
|
|
|
|
|
|
|
|
std::cout << "preparing..." << std::endl; |
|
|
|
std::vector<uint64_t> all_cases; |
|
|
|
auto a = AllCases(AllCases::ALL_CASES); |
|
|
|
for (int head = 0; head < 16; ++head) { |
|
|
|
uint64_t prefix = (uint64_t)head << 32; |
|
|
|
for (const auto &range : (*a.get_all_cases())[head]) { |
|
|
|
all_cases.emplace_back(prefix | range); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// auto s = ShortCode(ShortCode::Mode::NORMAL);
|
|
|
|
auto s = ShortCode(ShortCode::Mode::FAST); |
|
|
|
std::cout << "start working" << std::endl; |
|
|
|
|
|
|
|
for (auto short_code = 0; short_code < all_cases.size(); ++short_code) { |
|
|
|
uint64_t common_code = all_cases[short_code]; |
|
|
|
// std::cout << "preparing..." << std::endl;
|
|
|
|
// std::vector<uint64_t> all_cases;
|
|
|
|
// auto a = AllCases(AllCases::ALL_CASES);
|
|
|
|
// for (int head = 0; head < 16; ++head) {
|
|
|
|
// uint64_t prefix = (uint64_t)head << 32;
|
|
|
|
// for (const auto &range : (*a.get_all_cases())[head]) {
|
|
|
|
// all_cases.emplace_back(prefix | range);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//// auto s = ShortCode(ShortCode::Mode::NORMAL);
|
|
|
|
// auto s = ShortCode(ShortCode::Mode::FAST);
|
|
|
|
// std::cout << "start working" << std::endl;
|
|
|
|
//
|
|
|
|
// for (auto short_code = 0; short_code < all_cases.size(); ++short_code) {
|
|
|
|
// uint64_t common_code = all_cases[short_code];
|
|
|
|
//
|
|
|
|
// if (short_code != s.zip_short_code(common_code)) {
|
|
|
|
// printf("ERROR: zip %d\n", short_code);
|
|
|
|
// }
|
|
|
|
// if (common_code != s.unzip_short_code(short_code)) {
|
|
|
|
// printf("ERROR: unzip %09lX\n", common_code);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if (short_code % 2000000 == 0) {
|
|
|
|
//// if (short_code % 10000 == 0) {
|
|
|
|
// std::cout << ((float)short_code / (float)all_cases.size() * 100) << "%" << std::endl;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// std::cout << "complete verify" << std::endl;
|
|
|
|
|
|
|
|
if (short_code != s.zip_short_code(common_code)) { |
|
|
|
printf("ERROR: zip %d\n", short_code); |
|
|
|
} |
|
|
|
if (common_code != s.unzip_short_code(short_code)) { |
|
|
|
printf("ERROR: unzip %09lX\n", common_code); |
|
|
|
} |
|
|
|
|
|
|
|
if (short_code % 2000000 == 0) { |
|
|
|
// if (short_code % 10000 == 0) {
|
|
|
|
std::cout << ((float)short_code / (float)all_cases.size() * 100) << "%" << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
std::cout << "complete verify" << std::endl; |
|
|
|
std::cout << ShortCode::code_to_string(14323231) << std::endl; |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|