From f5a54fb979b5d3d7c406a09b331e8f9368a8146c Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Mon, 23 Jan 2023 23:42:23 +0800 Subject: [PATCH] test: basic ranges size --- CMakeLists.txt | 9 +++++++++ test/CMakeLists.txt | 6 ++++++ test/all_cases.cc | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 test/CMakeLists.txt create mode 100644 test/all_cases.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 19b8d51..d9bf33c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,3 +13,12 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") add_compile_options(-fPIC) add_subdirectory(src) + +################################################ + +enable_testing() +add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL) +include_directories(third_party/googletest/googletest/include) +add_subdirectory(test) + +################################################ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..3df7977 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.0) + +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) +add_test(NAME all_cases COMMAND test_all_cases) diff --git a/test/all_cases.cc b/test/all_cases.cc new file mode 100644 index 0000000..71d4b0e --- /dev/null +++ b/test/all_cases.cc @@ -0,0 +1,10 @@ +#include +#include "all_cases.h" +#include "gtest/gtest.h" + +const uint32_t BASIC_RANGES_SIZE = 7311921; + +TEST(AllCases, basic_ranges_size) { + auto &basic_ranges = BasicRanges::fetch(); + EXPECT_EQ(basic_ranges.size(), BASIC_RANGES_SIZE); +}