From 4fcf5a1971ebb74fce0556a42ab94c597f7a935c Mon Sep 17 00:00:00 2001 From: bergmann Date: Thu, 1 Aug 2019 16:46:52 +0200 Subject: [PATCH] * Fixed bug: cmake variables are not initialized correctly (because they depend on the options, and the options are included after the variables) * Changed filenames of the tests --- projects/helloworld/CMakeLists.txt | 2 +- projects/helloworld/test/CMakeLists.txt | 1 + .../helloworld/test/helloworld/helloworld-tests.cpp | 11 ----------- .../helloworld/test/helloworld/helloworld_tests.cpp | 10 ++++++++++ projects/libhelloworld/CMakeLists.txt | 2 +- projects/libhelloworld/test/CMakeLists.txt | 1 + ...ibhelloworld-tests.cpp => libhelloworld_tests.cpp} | 3 +-- 7 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 projects/helloworld/test/helloworld/helloworld-tests.cpp create mode 100644 projects/helloworld/test/helloworld/helloworld_tests.cpp rename projects/libhelloworld/test/libhelloworld/{libhelloworld-tests.cpp => libhelloworld_tests.cpp} (56%) diff --git a/projects/helloworld/CMakeLists.txt b/projects/helloworld/CMakeLists.txt index 0d61243..ddb0ba1 100644 --- a/projects/helloworld/CMakeLists.txt +++ b/projects/helloworld/CMakeLists.txt @@ -20,8 +20,8 @@ EndIf ( ) # Project ######################################################################################### -Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/helloworld-var.cmake ) Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/helloworld-options.cmake ) +Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/helloworld-var.cmake ) Project ( helloworld DESCRIPTION "A simple library" VERSION "${HELLOWORLD_VERSION}" ) diff --git a/projects/helloworld/test/CMakeLists.txt b/projects/helloworld/test/CMakeLists.txt index a36814f..6b522ef 100644 --- a/projects/helloworld/test/CMakeLists.txt +++ b/projects/helloworld/test/CMakeLists.txt @@ -26,6 +26,7 @@ ForEach ( FILE IN LISTS ISEF_TEST_SOURCE_FILES ) Set ( TEST_NAME "${TEST_DIR}/${TEST_NAME}" ) String ( REPLACE "\\" "-" TEST_NAME "${TEST_NAME}" ) String ( REPLACE "/" "-" TEST_NAME "${TEST_NAME}" ) + String ( REPLACE "_" "-" TEST_NAME "${TEST_NAME}" ) Set ( TEST_NAME "test-${TEST_NAME}" ) Add_Executable ( ${TEST_NAME} EXCLUDE_FROM_ALL diff --git a/projects/helloworld/test/helloworld/helloworld-tests.cpp b/projects/helloworld/test/helloworld/helloworld-tests.cpp deleted file mode 100644 index 0877beb..0000000 --- a/projects/helloworld/test/helloworld/helloworld-tests.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -#include - -using namespace ::testing; -using namespace ::helloworld; - -TEST(helloworld, getHelloWorldEx) -{ - EXPECT_EQ(DummyEx::getHelloWorldEx(), "Hello World!\nThis is a simple executable :)"); -} diff --git a/projects/helloworld/test/helloworld/helloworld_tests.cpp b/projects/helloworld/test/helloworld/helloworld_tests.cpp new file mode 100644 index 0000000..ed72d7e --- /dev/null +++ b/projects/helloworld/test/helloworld/helloworld_tests.cpp @@ -0,0 +1,10 @@ +#include + +#include + +using namespace ::testing; +using namespace ::helloworld; + +TEST(helloworld_tests, dummy) +{ +} diff --git a/projects/libhelloworld/CMakeLists.txt b/projects/libhelloworld/CMakeLists.txt index 3ec179e..02cdec9 100644 --- a/projects/libhelloworld/CMakeLists.txt +++ b/projects/libhelloworld/CMakeLists.txt @@ -20,8 +20,8 @@ EndIf ( ) # Project ######################################################################################### -Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhelloworld-var.cmake ) Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhelloworld-options.cmake ) +Include ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libhelloworld-var.cmake ) Project ( libhelloworld DESCRIPTION "A simple library" VERSION "${LIBHELLOWORLD_VERSION}" ) diff --git a/projects/libhelloworld/test/CMakeLists.txt b/projects/libhelloworld/test/CMakeLists.txt index c3af7e1..42e518f 100644 --- a/projects/libhelloworld/test/CMakeLists.txt +++ b/projects/libhelloworld/test/CMakeLists.txt @@ -26,6 +26,7 @@ ForEach ( FILE IN LISTS ISEF_TEST_SOURCE_FILES ) Set ( TEST_NAME "${TEST_DIR}/${TEST_NAME}" ) String ( REPLACE "\\" "-" TEST_NAME "${TEST_NAME}" ) String ( REPLACE "/" "-" TEST_NAME "${TEST_NAME}" ) + String ( REPLACE "_" "-" TEST_NAME "${TEST_NAME}" ) Set ( TEST_NAME "test-${TEST_NAME}" ) Add_Executable ( ${TEST_NAME} EXCLUDE_FROM_ALL diff --git a/projects/libhelloworld/test/libhelloworld/libhelloworld-tests.cpp b/projects/libhelloworld/test/libhelloworld/libhelloworld_tests.cpp similarity index 56% rename from projects/libhelloworld/test/libhelloworld/libhelloworld-tests.cpp rename to projects/libhelloworld/test/libhelloworld/libhelloworld_tests.cpp index 7542845..3ef2dfd 100644 --- a/projects/libhelloworld/test/libhelloworld/libhelloworld-tests.cpp +++ b/projects/libhelloworld/test/libhelloworld/libhelloworld_tests.cpp @@ -5,7 +5,6 @@ using namespace ::testing; using namespace ::libhelloworld; -TEST(libhelloworld, getHelloWorld) +TEST(libhelloworld_tests, dummy) { - EXPECT_EQ(Dummy::getHelloWorld(), "Hello World!"); }