ADD_DEFINITIONS(-DCLITK_TEST_DATA_PATH="${CLITK_TEST_DATA_PATH}")
#=========================================================
#=========================================================
-# Google test macro
-macro(ADD_GOOGLE_TESTS executable)
- foreach ( source ${ARGN} )
- file(READ "${source}" contents)
- string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
- foreach(hit ${found_tests})
- string(REGEX REPLACE ".*\\(([A-Za-z_0-9]+)[, ]*([A-Za-z_0-9]+)\\).*" "\\1.\\2" test_name ${hit})
- add_test(${test_name} ${executable} --gtest_filter=${test_name})
- endforeach(hit)
- endforeach()
-endmacro()
-#=========================================================
-#=========================================================
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/tests/bin)
SET(BUILDNAME ${CMAKE_SYSTEM_NAME}${CMAKE_OSX_ARCHITECTURES} CACHE INTERNAL DOCSTRING)
#=========================================================
#=========================================================
-# GoogleTest framemwork
-FIND_PATH(GTEST_DIR gtest)
-INCLUDE_DIRECTORIES(${GTEST_DIR}/include/)
-
-FIND_LIBRARY(GTEST_LIB NAMES gtest PATHS ${GTEST_DIR}/build/)
-ADD_LIBRARY(gtest UNKNOWN IMPORTED)
-SET_PROPERTY(TARGET gtest PROPERTY IMPORTED_LOCATION "${GTEST_LIB}")
-#=========================================================
-#=========================================================
# Enabled options to test
IF(CLITK_BUILD_TOOLS)
ADD_SUBDIRECTORY(tools)
ENDIF()
-IF(CLITK_BUILD_VV)
- ADD_SUBDIRECTORY(vv)
-ENDIF()
+#IF(CLITK_BUILD_VV)
+# ADD_SUBDIRECTORY(vv)
+#ENDIF()
# IF(CLITK_BUILD_SEGMENTATION)
# ADD_SUBDIRECTORY(segmentation)
# ENDIF()
+++ /dev/null
-include_directories(
- ${PROJECT_SOURCE_DIR}/vv
- ${PROJECT_BINARY_DIR}/vv
- ${QT_QTGUI_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR}
- ${QT_QTNETWORK_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR}/../
- ${PROJECT_SOURCE_DIR}/common
- ${PROJECT_SOURCE_DIR}/tools
- ${PROJECT_SOURCE_DIR}/segmentation
- ${QT_LIBRARY_DIR}
- ${GTEST_DIR}/include
-)
-FILE(GLOB srcs *.cxx)
-ADD_EXECUTABLE(vvTest ${srcs})
-target_link_libraries(vvTest vvLib gtest)
-
-# Add all tests found in the source code, calling the executable to run them
-add_google_tests ( ${EXECUTABLE_OUTPUT_PATH}/vvTest ${srcs})
-SET(BUILDNAME ${BUILDNAME}_vv CACHE INTERNAL DOCSTRING)
+++ /dev/null
-#include "gtest/gtest.h"
-#include <iostream>
-#include <QApplication>
-int main(int argc, char** argv){
- QApplication* q=new QApplication ( argc, argv );
- ::testing::InitGoogleTest(&argc, argv);
-
- int a=RUN_ALL_TESTS();
- delete q;
- return a;
-}
+++ /dev/null
-/*=========================================================================
- Program: vv http://www.creatis.insa-lyon.fr/rio/vv
-
- Authors belong to:
- - University of LYON http://www.universite-lyon.fr/
- - Léon Bérard cancer center http://www.centreleonberard.fr
- - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the copyright notices for more information.
-
- It is distributed under dual licence
-
- - BSD See included LICENSE.txt file
- - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-===========================================================================*/
-#include "vvRegisterForm.h"
-#include <QUrl>
-#include <QSettings>
-#include "gtest/gtest.h"
-#include "vvConfiguration.h"
-#include <stdio.h>
-#include <fstream>
-const std::string data_path = CLITK_TEST_DATA_PATH;
-TEST(vvRegisterForm, canPush){
- QUrl url;
- //the file exists with some old lines
- vvRegisterForm* v=new vvRegisterForm(url, QString::fromStdString(data_path+".settingsCanPush.txt"), QSettings::NativeFormat);
- std::ifstream inFile((data_path+".settingsCanPush.txt").c_str(), std::ifstream::in);
- ASSERT_FALSE(inFile.fail());
- EXPECT_TRUE(v->canPush());
-
- //the file doesn't exist
- vvRegisterForm* v2=new vvRegisterForm(url, QString::fromStdString(data_path+".settings_notFound.txt"), QSettings::NativeFormat);
- EXPECT_TRUE(v2->canPush());
-
- //the current version is the same
- QString strSettings=QString::fromStdString(data_path+".settings2.txt");
- QSettings settings(strSettings, QSettings::NativeFormat);
- settings.setValue("vvVersion", VV_VERSION);
- vvRegisterForm* v3=new vvRegisterForm(url, strSettings, QSettings::NativeFormat);
- EXPECT_FALSE(v3->canPush());
-}
-TEST(vvRegisterForm, acquitPushed){
- QUrl url;
- vvRegisterForm* v=new vvRegisterForm(url, QString::fromStdString(data_path+".settingsAcquit.txt"), QSettings::NativeFormat);
- ASSERT_TRUE(v->canPush());
- v->acquitPushed();
- EXPECT_FALSE(v->canPush());
- remove((data_path+".settingsAcquit.txt").c_str());
-}