mirror of
https://github.com/NGSolve/netgen.git
synced 2025-05-06 10:40:48 +05:00
Merge cb1e8d12695b25886c05cb59d1dadb4e4a881d57 into a9e8f2a1c9df7363710aa6213eca608c0bcc71ec
This commit is contained in:
commit
af82eb9b3a
@ -3,12 +3,18 @@ if(ENABLE_UNIT_TESTS)
|
|||||||
add_custom_target(unit_tests)
|
add_custom_target(unit_tests)
|
||||||
|
|
||||||
# Build catch_main test object
|
# Build catch_main test object
|
||||||
|
find_package(Catch2 REQUIRED)
|
||||||
include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR})
|
include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR})
|
||||||
add_library(catch_main STATIC main.cpp)
|
add_library(catch_main STATIC main.cpp)
|
||||||
set_target_properties(catch_main PROPERTIES CXX_STANDARD 17)
|
set_target_properties(catch_main PROPERTIES CXX_STANDARD 17)
|
||||||
add_dependencies(unit_tests catch_main)
|
add_dependencies(unit_tests catch_main)
|
||||||
add_dependencies(catch_main project_catch)
|
add_dependencies(catch_main project_catch)
|
||||||
|
|
||||||
|
if (Catch2_VERSION VERSION_GREATER_EQUAL 3)
|
||||||
|
target_compile_options(catch_main PUBLIC -DCATCH2_v3)
|
||||||
|
target_link_libraries(catch_main Catch2::Catch2WithMain)
|
||||||
|
endif()
|
||||||
|
|
||||||
# ensure the test targets are built before testing
|
# ensure the test targets are built before testing
|
||||||
add_test(NAME unit_tests_built COMMAND ${CMAKE_COMMAND} --build . --target unit_tests --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. )
|
add_test(NAME unit_tests_built COMMAND ${CMAKE_COMMAND} --build . --target unit_tests --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. )
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
#include "catch2/catch_all.hpp"
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
#include <../core/ngcore.hpp>
|
#include <../core/ngcore.hpp>
|
||||||
#include <core/register_archive.hpp>
|
#include <core/register_archive.hpp>
|
||||||
#include <core/logging.hpp>
|
#include <core/logging.hpp>
|
||||||
@ -354,7 +358,11 @@ void testArchive(Archive& in, Archive& out)
|
|||||||
SECTION("Not registered")
|
SECTION("Not registered")
|
||||||
{
|
{
|
||||||
SharedPtrAndPtrHolder* p = new NotRegisteredForArchive;
|
SharedPtrAndPtrHolder* p = new NotRegisteredForArchive;
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
REQUIRE_THROWS(out & p, Catch::Matchers::ContainsSubstring("not registered for archive"));
|
||||||
|
#else
|
||||||
REQUIRE_THROWS(out & p, Catch::Contains("not registered for archive"));
|
REQUIRE_THROWS(out & p, Catch::Contains("not registered for archive"));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
SECTION("Non-default constructor")
|
SECTION("Non-default constructor")
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
#include "catch2/catch_all.hpp"
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
#include <core/array.hpp>
|
#include <core/array.hpp>
|
||||||
using namespace ngcore;
|
using namespace ngcore;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
#define DO_NOT_USE_WMAIN
|
#define DO_NOT_USE_WMAIN
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
#include "catch2/catch_all.hpp"
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
#include "catch2/catch_all.hpp"
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <core/array.hpp>
|
#include <core/array.hpp>
|
||||||
#include <core/ranges.hpp>
|
#include <core/ranges.hpp>
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
#include "catch2/catch_all.hpp"
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
#include <../core/ngcore.hpp>
|
#include <../core/ngcore.hpp>
|
||||||
using namespace ngcore;
|
using namespace ngcore;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
#include "catch2/catch_all.hpp"
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
#include <core/ngcore.hpp>
|
#include <core/ngcore.hpp>
|
||||||
using namespace ngcore;
|
using namespace ngcore;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
|
#ifdef CATCH2_v3
|
||||||
|
#include "catch2/catch_all.hpp"
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
#include <../core/ngcore.hpp>
|
#include <../core/ngcore.hpp>
|
||||||
using namespace ngcore;
|
using namespace ngcore;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user