From 855ab61e7347f6de6198b1011d4458456beb1de1 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 24 Jan 2023 00:26:45 +0800 Subject: [PATCH] test: enable md5 hash check --- CMakeLists.txt | 3 +-- test/CMakeLists.txt | 16 +++++++++++++++- test/all_cases.cc | 9 +++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9bf33c..c3b3dab 100644 --- a/CMakeLists.txt +++ b/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) +add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL) add_subdirectory(test) ################################################ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3df7977..23e1bc2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,20 @@ 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) 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) + +################################################################ diff --git a/test/all_cases.cc b/test/all_cases.cc index 71d4b0e..841cd74 100644 --- a/test/all_cases.cc +++ b/test/all_cases.cc @@ -1,4 +1,5 @@ #include +#include "md5.h" #include "all_cases.h" #include "gtest/gtest.h" @@ -8,3 +9,11 @@ TEST(AllCases, basic_ranges_size) { auto &basic_ranges = BasicRanges::fetch(); 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); +}