Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert tests to gtest #7

Merged
merged 2 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 10 additions & 2 deletions test/src/raccoon_test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#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);
}
Loading