From 26644f56cc529c3de2dadcd961d7d0f1f25bcd1d Mon Sep 17 00:00:00 2001 From: LBer Date: Tue, 25 Jan 2022 16:15:39 +0100 Subject: [PATCH] tests not working #1 --- test/performance/CMakeLists.txt | 11 +++++++++++ test/performance/run.cpp | 3 +++ test/unit/CMakeLists.txt | 2 +- test/unit/method/CMakeLists.txt | 19 +++++++++++++++++++ test/unit/method/test_compare.hpp | 4 ++++ 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/performance/CMakeLists.txt create mode 100644 test/unit/method/CMakeLists.txt diff --git a/test/performance/CMakeLists.txt b/test/performance/CMakeLists.txt new file mode 100644 index 0000000..82df7d4 --- /dev/null +++ b/test/performance/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable(performance_test run.cpp) +configure_file(configuration.lua configuration.lua COPYONLY) +ADD_CUSTOM_TARGET(performance_test_sync ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/configuration ${CMAKE_CURRENT_BINARY_DIR}/configuration + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/result ${CMAKE_CURRENT_BINARY_DIR}/result + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/module_performance ${CMAKE_CURRENT_BINARY_DIR}/module_performance) +add_dependencies(performance_test performance_test_sync) +target_link_libraries(performance_test verdandi gtest_main) + +include(GoogleTest) +gtest_discover_tests(performance_test) \ No newline at end of file diff --git a/test/performance/run.cpp b/test/performance/run.cpp index 6846cd2..d1d3dbc 100644 --- a/test/performance/run.cpp +++ b/test/performance/run.cpp @@ -27,6 +27,9 @@ #define VERDANDI_WITH_TRAJECTORY_MANAGER #include "Verdandi.hxx" +#define VERDANDI_GTEST_MODEL Verdandi::QuadraticModel +#define VERDANDI_GTEST_MODEL_PATH "model/QuadraticModel.cxx" +#define VERDANDI_GTEST_CONFIG_PATH "configuration.lua" #include VERDANDI_GTEST_MODEL_PATH #include "seldon/computation/optimization/NLoptSolver.cxx" #include "seldon/SeldonSolver.hxx" diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 8affa4c..3945584 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -1,3 +1,3 @@ -#add_subdirectory(method) +add_subdirectory(method) add_subdirectory(model) add_subdirectory(tool) \ No newline at end of file diff --git a/test/unit/method/CMakeLists.txt b/test/unit/method/CMakeLists.txt new file mode 100644 index 0000000..12860f5 --- /dev/null +++ b/test/unit/method/CMakeLists.txt @@ -0,0 +1,19 @@ +# add_executable(TestInstantiator TestInstantiator.cxx) +# target_link_libraries(TestInstantiator vtkCommon) +# add_test(NAME TestInstantiator +# COMMAND TestInstantiator) + +# set(VERDANDI_GTEST_MODEL "Verdandi::QuadraticModel") +# set(VERDANDI_GTEST_CONFIG_PATH "\'\"configuration.lua\"\'") + +add_executable(method_test run.cpp) +configure_file(configuration.lua configuration.lua COPYONLY) +ADD_CUSTOM_TARGET(method_test_sync ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/configuration ${CMAKE_CURRENT_BINARY_DIR}/configuration + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/result ${CMAKE_CURRENT_BINARY_DIR}/result) +add_dependencies(method_test method_test_sync) + +target_link_libraries( method_test seldon verdandi gtest_main ) + +include(GoogleTest) +gtest_discover_tests(method_test) \ No newline at end of file diff --git a/test/unit/method/test_compare.hpp b/test/unit/method/test_compare.hpp index 751f5a9..ba47eea 100644 --- a/test/unit/method/test_compare.hpp +++ b/test/unit/method/test_compare.hpp @@ -31,6 +31,10 @@ #include "method/ReducedOrderExtendedKalmanFilter.cxx" #include "method/Nudging.cxx" +#define VERDANDI_GTEST_MODEL Verdandi::QuadraticModel +#define VERDANDI_GTEST_MODEL_PATH "model/QuadraticModel.cxx" +#define VERDANDI_GTEST_CONFIG_PATH "configuration.lua" + using namespace Verdandi; typedef Verdandi::Vector state;