Skip to content

Commit

Permalink
test: convert to gtest
Browse files Browse the repository at this point in the history
  • Loading branch information
egelja committed Jul 18, 2023
1 parent d5fa7fb commit bb18a10
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ include(cmake/variables.cmake)

configure_file(src/config.h.in config.h)

###############################
# XXX DISABLE TESTING FOR NOW #
###############################
set(BUILD_TESTING OFF)

# ---- Declare library ----

add_library(
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"hidden": true,
"inherits": "cmake-pedantic",
"cacheVariables": {
"NUTC24_DEVELOPER_MODE": "ON"
"raccoon_DEVELOPER_MODE": "ON"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def requirements(self):
self.requires("argparse/2.9") # argument parsing

def build_requirements(self):
self.test_requires("catch2/3.3.1")
self.test_requires("gtest/1.13.0")

def configure(self):
if self.settings.os == 'Windows':
Expand Down
8 changes: 4 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ project(raccoonTests LANGUAGES CXX)

# ---- Dependencies ----

find_package(Catch2 REQUIRED)
include(Catch)
find_package(GTest REQUIRED)
include(GoogleTest)

# ---- Tests ----

add_executable(raccoon_test src/raccoon_test.cpp)
target_link_libraries(
raccoon_test PRIVATE
raccoon_lib
Catch2::Catch2WithMain
GTest::gtest_main
)
target_compile_features(raccoon_test PRIVATE cxx_std_20)

catch_discover_tests(raccoon_test)
gtest_discover_tests(raccoon_test)

# ---- End-of-file commands ----

Expand Down
11 changes: 9 additions & 2 deletions test/src/raccoon_test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#include <catch2/catch_test_macros.hpp>
#include <gtest/gtest.h>

TEST_CASE("Name is raccoon", "[library]") {}
// Demonstrate some basic assertions.
TEST(HelloTest, BasicAssertions) {
// Expect two strings not to be equal.
EXPECT_STRNE("hello", "world");

// Expect equality.
EXPECT_EQ(7 * 6, 42);
}

0 comments on commit bb18a10

Please sign in to comment.