From 2bc04352f57ab39cc178db907c216b5606023613 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 24 Jan 2023 22:16:23 +0800 Subject: [PATCH] test: md5sum of basic ranges data --- test/all_cases.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/all_cases.cc b/test/all_cases.cc index 841cd74..79923f7 100644 --- a/test/all_cases.cc +++ b/test/all_cases.cc @@ -4,6 +4,7 @@ #include "gtest/gtest.h" const uint32_t BASIC_RANGES_SIZE = 7311921; +const char BASIC_RANGES_MD5[] = "6f385dc171e201089ff96bb010b47212"; TEST(AllCases, basic_ranges_size) { auto &basic_ranges = BasicRanges::fetch(); @@ -11,9 +12,12 @@ TEST(AllCases, basic_ranges_size) { } TEST(AllCases, basic_ranges_data) { - auto &basic_ranges = BasicRanges::fetch(); - - std::cout << md5("dnomd343", 8) << std::endl; - -// EXPECT_EQ(basic_ranges.size(), BASIC_RANGES_SIZE); + auto *basic_ranges_data = new char[BASIC_RANGES_SIZE * 9]; + auto *current = basic_ranges_data; + for (const auto &range : BasicRanges::fetch()) { + sprintf(current, "%08X\n", range); + current += 9; + } + auto basic_ranges_md5 = md5(basic_ranges_data, BASIC_RANGES_SIZE * 9); + EXPECT_STREQ(basic_ranges_md5.c_str(), BASIC_RANGES_MD5); }