Skip to content

Commit

Permalink
Merge pull request #2 from threeal/use-catch2
Browse files Browse the repository at this point in the history
Use Catch2
  • Loading branch information
threeal authored Dec 1, 2022
2 parents dee9ead + b7159af commit e417abe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ if(BUILD_TESTING)
enable_testing()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -coverage")

find_package(googletest REQUIRED)
find_package(Catch2 REQUIRED)

add_executable(result_test test/result_test.cpp)
target_link_libraries(result_test PRIVATE gtest_main)
gtest_discover_tests(result_test)
target_link_libraries(result_test PRIVATE Catch2::Catch2WithMain)
catch_discover_tests(result_test)
endif()
8 changes: 8 additions & 0 deletions cmake/FindCatch2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if(Catch2_FOUND)
return()
endif()

include(CPM)
CPMAddPackage("gh:catchorg/Catch2@3.2.0")

include("${Catch2_SOURCE_DIR}/extras/Catch.cmake")
13 changes: 0 additions & 13 deletions cmake/Findgoogletest.cmake

This file was deleted.

6 changes: 3 additions & 3 deletions test/result_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include <catch2/catch_test_macros.hpp>

TEST(ResultTest, Dummy) {
EXPECT_TRUE(true);
TEST_CASE("example test") {
REQUIRE(true);
}

0 comments on commit e417abe

Please # to comment.