Skip to content
Snippets Groups Projects
Commit 8b279dfa authored by Harald Scheirich's avatar Harald Scheirich
Browse files

ENH:Add a main to run the unittests

parent 3fffec1f
No related branches found
No related tags found
No related merge requests found
......@@ -50,10 +50,11 @@ function(imstk_add_test_internal target kind)
# Link test driver against current target, gtest and pthread
target_link_libraries(${test_driver_executable}
${target}
Testing
Threads::Threads
GTest::gtest
GTest::gmock
GTest::gtest_main
Threads::Threads
)
if (MSVC)
......
......@@ -377,6 +377,7 @@ add_subdirectory(Source/CollisionDetection)
add_subdirectory(Source/CollisionHandling)
add_subdirectory(Source/Scene)
add_subdirectory(Source/SimulationManager)
add_subdirectory(Source/Testing)
add_subdirectory(Source/Filtering)
add_subdirectory(Source/FilteringCore)
......
#-----------------------------------------------------------------------------
# Create target
#-----------------------------------------------------------------------------
if( ${PROJECT_NAME}_BUILD_TESTING )
include(imstkAddLibrary)
imstk_add_library( Testing
DEPENDS
Common
GTest::gtest
${VTK_LIBRARIES}
)
endif()
\ No newline at end of file
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#include <vtksys/SystemTools.hxx>
#include <gtest/gtest.h>
#include "imstkLogger.h"
int
main(int argc, char** argv)
{
bool removeLog = true;
for (int i = 0; i < argc; ++i)
{
if (std::string(argv[i]) == "--imstk_keep_log")
{
removeLog = true;
}
}
if (removeLog)
{
vtksys::SystemTools::RemoveADirectory("testlog");
vtksys::SystemTools::MakeDirectory("testlog");
}
auto& logger = imstk::Logger::getInstance();
logger.addFileSink("test", "testlog");
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment