diff --git a/Tests/UnitTests/CMakeLists.txt b/Tests/UnitTests/CMakeLists.txt index 70be9b2fe4b2923c8042204c147f67c3b8f4549e..e85d0f800c0968cc26cf00ca8b555c67b1e58d3b 100644 --- a/Tests/UnitTests/CMakeLists.txt +++ b/Tests/UnitTests/CMakeLists.txt @@ -12,6 +12,6 @@ if(UNITTESTS) endif() # to show directory in Qt creator project tree - FILE(GLOB_RECURSE UtilityFiles "utilities/*.h") + FILE(GLOB_RECURSE UtilityFiles "utilities/*.*") add_custom_target(UnitTestUtilities SOURCES ${UtilityFiles}) endif() diff --git a/Tests/UnitTests/Core/DataStructure/main.cpp b/Tests/UnitTests/Core/DataStructure/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/DataStructure/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/Detector/main.cpp b/Tests/UnitTests/Core/Detector/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/Detector/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/ExportToPython/main.cpp b/Tests/UnitTests/Core/ExportToPython/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/ExportToPython/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/Fresnel/main.cpp b/Tests/UnitTests/Core/Fresnel/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/Fresnel/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/Numeric0/main.cpp b/Tests/UnitTests/Core/Numeric0/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/Numeric0/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/Numeric1/main.cpp b/Tests/UnitTests/Core/Numeric1/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/Numeric1/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/Other/main.cpp b/Tests/UnitTests/Core/Other/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/Other/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/Parameters/main.cpp b/Tests/UnitTests/Core/Parameters/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/Parameters/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Core/Sample/main.cpp b/Tests/UnitTests/Core/Sample/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Core/Sample/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Fit/0/main.cpp b/Tests/UnitTests/Fit/0/main.cpp deleted file mode 100644 index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..0000000000000000000000000000000000000000 --- a/Tests/UnitTests/Fit/0/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif - -#include "testlist.h" -#include "ErrorStreamRedirect.h" - -int main(int argc, char** argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - // redirect std::cerr stream - std::stringstream oss; - ErrorStreamRedirect redirecter( oss.rdbuf() ); - (void)redirecter; - - // run all google tests - return RUN_ALL_TESTS(); -} diff --git a/Tests/UnitTests/Fit/CMakeLists.txt b/Tests/UnitTests/Fit/CMakeLists.txt index 0533f7fc76983096fc310cdfc2aa07adc1ffda4b..fe4782c9f873445413c5f443288a5c755a68d460 100644 --- a/Tests/UnitTests/Fit/CMakeLists.txt +++ b/Tests/UnitTests/Fit/CMakeLists.txt @@ -21,5 +21,5 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_LINKED_AS_SHARED_LIBRARY=1") set(libs BornAgainCore BornAgainFit) -ADD_GTEST(Fit "0" "${libs}" 0) +ADD_GTEST(Fit "FitKernel" "${libs}" 0) diff --git a/Tests/UnitTests/Fit/0/AttLimitsTest.h b/Tests/UnitTests/Fit/FitKernel/AttLimitsTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/AttLimitsTest.h rename to Tests/UnitTests/Fit/FitKernel/AttLimitsTest.h diff --git a/Tests/UnitTests/Fit/0/FitObjectTest.h b/Tests/UnitTests/Fit/FitKernel/FitObjectTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/FitObjectTest.h rename to Tests/UnitTests/Fit/FitKernel/FitObjectTest.h diff --git a/Tests/UnitTests/Fit/0/FitParameterSetTest.h b/Tests/UnitTests/Fit/FitKernel/FitParameterSetTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/FitParameterSetTest.h rename to Tests/UnitTests/Fit/FitKernel/FitParameterSetTest.h diff --git a/Tests/UnitTests/Fit/0/FitParameterTest.h b/Tests/UnitTests/Fit/FitKernel/FitParameterTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/FitParameterTest.h rename to Tests/UnitTests/Fit/FitKernel/FitParameterTest.h diff --git a/Tests/UnitTests/Fit/0/FitSuiteTest.h b/Tests/UnitTests/Fit/FitKernel/FitSuiteTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/FitSuiteTest.h rename to Tests/UnitTests/Fit/FitKernel/FitSuiteTest.h diff --git a/Tests/UnitTests/Fit/0/IFitParameterTest.h b/Tests/UnitTests/Fit/FitKernel/IFitParameterTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/IFitParameterTest.h rename to Tests/UnitTests/Fit/FitKernel/IFitParameterTest.h diff --git a/Tests/UnitTests/Fit/0/MinimizerOptionsTest.h b/Tests/UnitTests/Fit/FitKernel/MinimizerOptionsTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/MinimizerOptionsTest.h rename to Tests/UnitTests/Fit/FitKernel/MinimizerOptionsTest.h diff --git a/Tests/UnitTests/Fit/0/MultiOptionTest.h b/Tests/UnitTests/Fit/FitKernel/MultiOptionTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/MultiOptionTest.h rename to Tests/UnitTests/Fit/FitKernel/MultiOptionTest.h diff --git a/Tests/UnitTests/Fit/0/OptionContainerTest.h b/Tests/UnitTests/Fit/FitKernel/OptionContainerTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/OptionContainerTest.h rename to Tests/UnitTests/Fit/FitKernel/OptionContainerTest.h diff --git a/Tests/UnitTests/Fit/0/RealLimitsTest.h b/Tests/UnitTests/Fit/FitKernel/RealLimitsTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/RealLimitsTest.h rename to Tests/UnitTests/Fit/FitKernel/RealLimitsTest.h diff --git a/Tests/UnitTests/Fit/0/StringUtilsTest.h b/Tests/UnitTests/Fit/FitKernel/StringUtilsTest.h similarity index 100% rename from Tests/UnitTests/Fit/0/StringUtilsTest.h rename to Tests/UnitTests/Fit/FitKernel/StringUtilsTest.h diff --git a/Tests/UnitTests/Fit/0/testlist.h b/Tests/UnitTests/Fit/FitKernel/testlist.h similarity index 100% rename from Tests/UnitTests/Fit/0/testlist.h rename to Tests/UnitTests/Fit/FitKernel/testlist.h diff --git a/Tests/UnitTests/Core/Axes/main.cpp b/Tests/UnitTests/utilities/main_testlist.cpp similarity index 61% rename from Tests/UnitTests/Core/Axes/main.cpp rename to Tests/UnitTests/utilities/main_testlist.cpp index a747eaaeff4ae7684086628fc1fd21df4d8f93c7..83146bac0eb3f23efe527ddbfb93bb877cc1a142 100644 --- a/Tests/UnitTests/Core/Axes/main.cpp +++ b/Tests/UnitTests/utilities/main_testlist.cpp @@ -1,15 +1,4 @@ -#ifdef _MSC_VER -#define _VARIADIC_MAX 10 -#endif - -#ifdef _WIN32 -#pragma warning ( push ) -#pragma warning ( disable: 4275 ) -#include <gtest/gtest.h> -#pragma warning ( pop ) -#else -#include <gtest/gtest.h> -#endif +#include "google_test.h" #include "testlist.h" #include "ErrorStreamRedirect.h" diff --git a/cmake/generic/modules/AddGTest.cmake b/cmake/generic/modules/AddGTest.cmake index ae2cd11fa282031e658cd4118c079c293ddd5ef6..155c332738518f35cb42086a84975c6a1d2dc712 100644 --- a/cmake/generic/modules/AddGTest.cmake +++ b/cmake/generic/modules/AddGTest.cmake @@ -22,7 +22,8 @@ MACRO(ADD_GTEST project subdir libs stage) set(TEST_NAME ${project}UnitTest${subdir}) set(EXE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TEST_NAME}) file(GLOB include_files ${subdir}/*.h) - add_executable(${TEST_NAME} ${subdir}/main.cpp ${include_files}) + include_directories(${subdir}) + add_executable(${TEST_NAME} ${subdir}/../../utilities/main_testlist.cpp ${include_files}) target_link_libraries(${TEST_NAME} gtest ${libs}) if (${stage} EQUAL 0) # Execute test just after compilation