Skip to content
Snippets Groups Projects
Commit 44351756 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

plugging Catch2 examples within CMake

parent 19fa98bf
No related branches found
No related tags found
No related merge requests found
...@@ -104,6 +104,18 @@ include_directories(src/scheme) ...@@ -104,6 +104,18 @@ include_directories(src/scheme)
include_directories(src/experimental) include_directories(src/experimental)
# Pastis tests
set(CATCH_MODULE_PATH "${PASTIS_SOURCE_DIR}/packages/Catch2")
set(CATCH_INCLUDE_PATH "${CATCH_MODULE_PATH}/single_include")
include("${CATCH_MODULE_PATH}/contrib/ParseAndAddCatchTests.cmake")
add_subdirectory("${CATCH_MODULE_PATH}")
add_subdirectory(tests)
enable_testing()
# ----------------------------------------------------- # -----------------------------------------------------
link_libraries("-rdynamic") link_libraries("-rdynamic")
......
include_directories("${CATCH_INCLUDE_PATH}")
#set(EXECUTABLE_OUTPUT_PATH ${PASTIS_BINARY_DIR})
add_executable (unit_tests
main.cpp
example.cpp
example2.cpp)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
target_link_libraries (unit_tests Catch)
enable_testing()
#parse catch tests
ParseAndAddCatchTests (unit_tests)
#add_dependencies(check
# DEPENDS exec_tests)
add_custom_target(check
COMMAND unit_tests
DEPENDS unit_tests)
#include <catch.hpp>
TEST_CASE("Test1", "[unit]") {
int a = 1;
int b = 2;
REQUIRE(a == b);
}
TEST_CASE("Test2") {
int a = 2;
int b = 2;
REQUIRE(a == b);
}
TEST_CASE("Test3", "[a][b][c]") {
int a = 1;
int b = 2;
REQUIRE(a != b);
}
#include <catch.hpp>
TEST_CASE("Test5", "[unit]") {
int a = 1;
int b = 2;
REQUIRE(a+1 == b);
}
TEST_CASE("Test6", "[a]") {
int a = 2;
int b = 2;
REQUIRE(a == b);
}
TEST_CASE("Test7", "[a][b][c]") {
int a = 1;
int b = 2;
REQUIRE(a != b);
}
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
// #define CATCH_CONFIG_RUNNER
// #include <catch.hpp>
// int main(int argc, char* argv[]) {
// auto result = Catch::Session().run(argc, argv);
// return (result < 0xff ? result : 0xff);
// }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment