Browse Source

test: enable md5 hash check

legacy
Dnomd343 2 years ago
parent
commit
855ab61e73
  1. 3
      CMakeLists.txt
  2. 16
      test/CMakeLists.txt
  3. 9
      test/all_cases.cc

3
CMakeLists.txt

@ -16,9 +16,8 @@ add_subdirectory(src)
################################################ ################################################
enable_testing()
add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL)
include_directories(third_party/googletest/googletest/include) include_directories(third_party/googletest/googletest/include)
add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL)
add_subdirectory(test) add_subdirectory(test)
################################################ ################################################

16
test/CMakeLists.txt

@ -1,6 +1,20 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
################################################################
enable_testing()
################################################################
include_directories(../third_party/md5)
add_library(md5 ../third_party/md5/md5.cpp)
################################################################
include_directories(../src/klotski/all_cases) include_directories(../src/klotski/all_cases)
add_executable(test_all_cases all_cases.cc) add_executable(test_all_cases all_cases.cc)
target_link_libraries(test_all_cases all_cases gtest gtest_main) target_link_libraries(test_all_cases gtest gtest_main)
target_link_libraries(test_all_cases md5 all_cases)
add_test(NAME all_cases COMMAND test_all_cases) add_test(NAME all_cases COMMAND test_all_cases)
################################################################

9
test/all_cases.cc

@ -1,4 +1,5 @@
#include <cstdint> #include <cstdint>
#include "md5.h"
#include "all_cases.h" #include "all_cases.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@ -8,3 +9,11 @@ TEST(AllCases, basic_ranges_size) {
auto &basic_ranges = BasicRanges::fetch(); auto &basic_ranges = BasicRanges::fetch();
EXPECT_EQ(basic_ranges.size(), BASIC_RANGES_SIZE); EXPECT_EQ(basic_ranges.size(), 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);
}

Loading…
Cancel
Save