init — unit tests
This commit is contained in:
parent
87f1181a1a
commit
22ebb857eb
@ -1,5 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.28)
|
cmake_minimum_required(VERSION 3.28 FATAL_ERROR)
|
||||||
project(raiiSafeCuda)
|
project(raiiSafeCuda CXX)
|
||||||
|
|
||||||
|
option(ENABLE_TESTS "Enable tests' cmake target." ON)
|
||||||
|
|
||||||
find_package(CUDAToolkit REQUIRED)
|
find_package(CUDAToolkit REQUIRED)
|
||||||
|
|
||||||
@ -13,3 +15,7 @@ set_target_properties(raiiSafeCuda PROPERTIES
|
|||||||
CXX_EXTENSIONS OFF
|
CXX_EXTENSIONS OFF
|
||||||
INTERPROCEDURAL_OPTIMIZATION ON
|
INTERPROCEDURAL_OPTIMIZATION ON
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ENABLE_TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif ()
|
||||||
|
26
tests/CMakeLists.txt
Normal file
26
tests/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
project(testsRaiiSafeCuda CXX)
|
||||||
|
|
||||||
|
find_package(Catch2)
|
||||||
|
if (NOT Catch2_FOUND)
|
||||||
|
message(STATUS "Using FetchContent to download and use Catch2")
|
||||||
|
include(FetchContent)
|
||||||
|
fetchcontent_declare(
|
||||||
|
Catch2
|
||||||
|
GIT_REPOSITORY https://github.com/catchorg/Catch2
|
||||||
|
GIT_TAG v3.5.3
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
OVERRIDE_FIND_PACKAGE
|
||||||
|
)
|
||||||
|
fetchcontent_makeavailable(Catch2)
|
||||||
|
find_package(Catch2 3 REQUIRED)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
enable_testing()
|
||||||
|
include(Catch)
|
||||||
|
include(CatchAddTests)
|
||||||
|
|
||||||
|
add_executable(tests tests_stream.cpp)
|
||||||
|
target_link_libraries(tests Catch2::Catch2WithMain)
|
||||||
|
|
||||||
|
catch_discover_tests(tests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
9
tests/tests_stream.cpp
Normal file
9
tests/tests_stream.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Created by postaron on 21/03/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <catch2/catch_all.hpp>
|
||||||
|
|
||||||
|
TEST_CASE("hello", "world") {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user