Loading CMakeLists.txt +4 −50 Original line number Diff line number Diff line Loading @@ -244,57 +244,11 @@ else() set( HAVE_SYS_RESOURCE_H "#define HAVE_SYS_RESOURCE_H 1" ) endif() #### # Check for cppunit # if( WITH_TESTS STREQUAL "yes" ) FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h /usr/local/include /usr/include DOC "CppUnit headers." ) #### # With Win32, important to have both # if(WIN32) FIND_LIBRARY(CPPUNIT_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) else(WIN32) # On unix system, debug and release have the same name FIND_LIBRARY(CPPUNIT_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) endif(WIN32) if( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" ) message( "CPPUNIT not found." ) set( HAVE_CPPUNIT "//#define HAVE_CPPUNIT 1" ) else( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" ) message( "CPPUNIT headers found -- ${CPPUNIT_INCLUDE_DIR}" ) if(CPPUNIT_LIBRARY) message( "CPPUNIT library found -- ${CPPUNIT_LIBRARY}" ) set(CPPUNIT_FOUND "YES") set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS}) set(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY} ${CMAKE_DL_LIBS}) set( HAVE_CPPUNIT "#define HAVE_CPPUNIT 1" ) endif(CPPUNIT_LIBRARY) endif( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" ) ENABLE_TESTING() INCLUDE( Dart ) find_package( GTest ) if( GTEST_FOUND ) set( CXX_TESTS_FLAGS "-DHAVE_GTEST" ) endif( GTEST_FOUND ) endif( WITH_TESTS STREQUAL "yes" ) #if( BUILD_MPI ) Loading src/CMakeLists.txt +2 −1 Original line number Diff line number Diff line ADD_SUBDIRECTORY( TNL ) ADD_SUBDIRECTORY( UnitTests ) No newline at end of file src/TNL/UniquePointer.h +12 −12 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** tnlUniquePointer.h - description UniquePointer.h - description ------------------- begin : May 6, 2016 copyright : (C) 2016 by Tomas Oberhuber Loading @@ -25,26 +25,26 @@ namespace TNL { template< typename Object, typename Device = typename Object::DeviceType > class tnlUniquePointer class UniquePointer { }; template< typename Object > class tnlUniquePointer< Object, Devices::Host > : public SmartPointer class UniquePointer< Object, Devices::Host > : public SmartPointer { public: typedef Object ObjectType; typedef Devices::Host DeviceType; typedef tnlUniquePointer< Object, Devices::Host > ThisType; typedef UniquePointer< Object, Devices::Host > ThisType; tnlUniquePointer() UniquePointer() { this->pointer = new Object(); } template< typename... Args > tnlUniquePointer( const Args... args ) UniquePointer( const Args... args ) { this->pointer = new Object( args... ); } Loading Loading @@ -99,7 +99,7 @@ class tnlUniquePointer< Object, Devices::Host > : public SmartPointer return true; } ~tnlUniquePointer() ~UniquePointer() { if( this->pointer ) delete this->pointer; Loading @@ -112,15 +112,15 @@ class tnlUniquePointer< Object, Devices::Host > : public SmartPointer }; template< typename Object > class tnlUniquePointer< Object, Devices::Cuda > : public SmartPointer class UniquePointer< Object, Devices::Cuda > : public SmartPointer { public: typedef Object ObjectType; typedef Devices::Host DeviceType; typedef tnlUniquePointer< Object, Devices::Host > ThisType; typedef UniquePointer< Object, Devices::Host > ThisType; tnlUniquePointer() UniquePointer() : modified( false ) { this->pointer = new Object(); Loading @@ -132,7 +132,7 @@ class tnlUniquePointer< Object, Devices::Cuda > : public SmartPointer } template< typename... Args > tnlUniquePointer( const Args... args ) UniquePointer( const Args... args ) : modified( false ) { this->pointer = new Object( args... ); Loading Loading @@ -218,7 +218,7 @@ class tnlUniquePointer< Object, Devices::Cuda > : public SmartPointer #endif } ~tnlUniquePointer() ~UniquePointer() { if( this->pointer ) delete this->pointer; Loading src/UnitTests/CMakeLists.txt 0 → 100755 +39 −0 Original line number Diff line number Diff line ADD_SUBDIRECTORY( Containers ) ADD_EXECUTABLE( UniquePointerTest${mpiExt}${debugExt} ${headers} UniquePointerTest.cpp ) SET_TARGET_PROPERTIES( UniquePointerTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( UniquePointerTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) IF( BUILD_CUDA ) CUDA_ADD_EXECUTABLE( FileTest${mpiExt}${debugExt} FileTest.h FileTest.cu ) SET_TARGET_PROPERTIES( FileTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( FileTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ELSE( BUILD_CUDA ) ADD_EXECUTABLE( FileTest${mpiExt}${debugExt} FileTest.h FileTest.cpp ) SET_TARGET_PROPERTIES( FileTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( FileTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ENDIF( BUILD_CUDA ) ADD_EXECUTABLE( StringTest${mpiExt}${debugExt} ${headers} StringTest.cpp ) SET_TARGET_PROPERTIES( StringTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( StringTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( ListTest${mpiExt}${debugExt} ${headers} ListTest.cpp ) SET_TARGET_PROPERTIES( ListTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( ListTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( ObjectTest${mpiExt}${debugExt} ${headers} ObjectTest.cpp ) SET_TARGET_PROPERTIES( ObjectTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( ObjectTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_TEST( FileTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/FileTest${mpiExt}${debugExt} ) ADD_TEST( StringTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/StringTest${mpiExt}${debugExt} ) ADD_TEST( ListTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/ListTest${mpiExt}${debugExt} ) ADD_TEST( ObjectTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/ObjectTest${mpiExt}${debugExt} ) No newline at end of file tests/unit-tests/core/arrays/tnlArrayOperationsTest.cpp→src/UnitTests/Containers/ArrayOperationsTest.cpp +1 −14 Original line number Diff line number Diff line Loading @@ -8,19 +8,6 @@ /* See Copyright Notice in tnl/Copyright */ #include "tnlArrayOperationsTester.h" #include "../../tnlUnitTestStarter.h" #include <TNL/Devices/Host.h> using namespace TNL; int main( int argc, char* argv[] ) { if( ! tnlUnitTestStarter :: run< ArrayOperationsTester< int, Devices::Host > >() ) return EXIT_FAILURE; return EXIT_SUCCESS; } #include "ArrayOperationsTest.h" Loading
CMakeLists.txt +4 −50 Original line number Diff line number Diff line Loading @@ -244,57 +244,11 @@ else() set( HAVE_SYS_RESOURCE_H "#define HAVE_SYS_RESOURCE_H 1" ) endif() #### # Check for cppunit # if( WITH_TESTS STREQUAL "yes" ) FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h /usr/local/include /usr/include DOC "CppUnit headers." ) #### # With Win32, important to have both # if(WIN32) FIND_LIBRARY(CPPUNIT_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) else(WIN32) # On unix system, debug and release have the same name FIND_LIBRARY(CPPUNIT_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit ${CPPUNIT_INCLUDE_DIR}/../lib /usr/local/lib /usr/lib) endif(WIN32) if( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" ) message( "CPPUNIT not found." ) set( HAVE_CPPUNIT "//#define HAVE_CPPUNIT 1" ) else( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" ) message( "CPPUNIT headers found -- ${CPPUNIT_INCLUDE_DIR}" ) if(CPPUNIT_LIBRARY) message( "CPPUNIT library found -- ${CPPUNIT_LIBRARY}" ) set(CPPUNIT_FOUND "YES") set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS}) set(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY} ${CMAKE_DL_LIBS}) set( HAVE_CPPUNIT "#define HAVE_CPPUNIT 1" ) endif(CPPUNIT_LIBRARY) endif( ${CPPUNIT_INCLUDE_DIR} STREQUAL "CPPUNIT_INCLUDE_DIR-NOTFOUND" ) ENABLE_TESTING() INCLUDE( Dart ) find_package( GTest ) if( GTEST_FOUND ) set( CXX_TESTS_FLAGS "-DHAVE_GTEST" ) endif( GTEST_FOUND ) endif( WITH_TESTS STREQUAL "yes" ) #if( BUILD_MPI ) Loading
src/CMakeLists.txt +2 −1 Original line number Diff line number Diff line ADD_SUBDIRECTORY( TNL ) ADD_SUBDIRECTORY( UnitTests ) No newline at end of file
src/TNL/UniquePointer.h +12 −12 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** tnlUniquePointer.h - description UniquePointer.h - description ------------------- begin : May 6, 2016 copyright : (C) 2016 by Tomas Oberhuber Loading @@ -25,26 +25,26 @@ namespace TNL { template< typename Object, typename Device = typename Object::DeviceType > class tnlUniquePointer class UniquePointer { }; template< typename Object > class tnlUniquePointer< Object, Devices::Host > : public SmartPointer class UniquePointer< Object, Devices::Host > : public SmartPointer { public: typedef Object ObjectType; typedef Devices::Host DeviceType; typedef tnlUniquePointer< Object, Devices::Host > ThisType; typedef UniquePointer< Object, Devices::Host > ThisType; tnlUniquePointer() UniquePointer() { this->pointer = new Object(); } template< typename... Args > tnlUniquePointer( const Args... args ) UniquePointer( const Args... args ) { this->pointer = new Object( args... ); } Loading Loading @@ -99,7 +99,7 @@ class tnlUniquePointer< Object, Devices::Host > : public SmartPointer return true; } ~tnlUniquePointer() ~UniquePointer() { if( this->pointer ) delete this->pointer; Loading @@ -112,15 +112,15 @@ class tnlUniquePointer< Object, Devices::Host > : public SmartPointer }; template< typename Object > class tnlUniquePointer< Object, Devices::Cuda > : public SmartPointer class UniquePointer< Object, Devices::Cuda > : public SmartPointer { public: typedef Object ObjectType; typedef Devices::Host DeviceType; typedef tnlUniquePointer< Object, Devices::Host > ThisType; typedef UniquePointer< Object, Devices::Host > ThisType; tnlUniquePointer() UniquePointer() : modified( false ) { this->pointer = new Object(); Loading @@ -132,7 +132,7 @@ class tnlUniquePointer< Object, Devices::Cuda > : public SmartPointer } template< typename... Args > tnlUniquePointer( const Args... args ) UniquePointer( const Args... args ) : modified( false ) { this->pointer = new Object( args... ); Loading Loading @@ -218,7 +218,7 @@ class tnlUniquePointer< Object, Devices::Cuda > : public SmartPointer #endif } ~tnlUniquePointer() ~UniquePointer() { if( this->pointer ) delete this->pointer; Loading
src/UnitTests/CMakeLists.txt 0 → 100755 +39 −0 Original line number Diff line number Diff line ADD_SUBDIRECTORY( Containers ) ADD_EXECUTABLE( UniquePointerTest${mpiExt}${debugExt} ${headers} UniquePointerTest.cpp ) SET_TARGET_PROPERTIES( UniquePointerTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( UniquePointerTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) IF( BUILD_CUDA ) CUDA_ADD_EXECUTABLE( FileTest${mpiExt}${debugExt} FileTest.h FileTest.cu ) SET_TARGET_PROPERTIES( FileTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( FileTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ELSE( BUILD_CUDA ) ADD_EXECUTABLE( FileTest${mpiExt}${debugExt} FileTest.h FileTest.cpp ) SET_TARGET_PROPERTIES( FileTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( FileTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ENDIF( BUILD_CUDA ) ADD_EXECUTABLE( StringTest${mpiExt}${debugExt} ${headers} StringTest.cpp ) SET_TARGET_PROPERTIES( StringTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( StringTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( ListTest${mpiExt}${debugExt} ${headers} ListTest.cpp ) SET_TARGET_PROPERTIES( ListTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( ListTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_EXECUTABLE( ObjectTest${mpiExt}${debugExt} ${headers} ObjectTest.cpp ) SET_TARGET_PROPERTIES( ObjectTest${mpiExt}${debugExt} PROPERTIES COMPILE_FLAGS "${CXX_TESTS_FLAGS}" ) TARGET_LINK_LIBRARIES( ObjectTest${mpiExt}${debugExt} ${GTEST_BOTH_LIBRARIES} tnl${mpiExt}${debugExt}-${tnlVersion} ) ADD_TEST( FileTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/FileTest${mpiExt}${debugExt} ) ADD_TEST( StringTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/StringTest${mpiExt}${debugExt} ) ADD_TEST( ListTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/ListTest${mpiExt}${debugExt} ) ADD_TEST( ObjectTest${mpiExt}${debugExt} ${EXECUTABLE_OUTPUT_PATH}/ObjectTest${mpiExt}${debugExt} ) No newline at end of file
tests/unit-tests/core/arrays/tnlArrayOperationsTest.cpp→src/UnitTests/Containers/ArrayOperationsTest.cpp +1 −14 Original line number Diff line number Diff line Loading @@ -8,19 +8,6 @@ /* See Copyright Notice in tnl/Copyright */ #include "tnlArrayOperationsTester.h" #include "../../tnlUnitTestStarter.h" #include <TNL/Devices/Host.h> using namespace TNL; int main( int argc, char* argv[] ) { if( ! tnlUnitTestStarter :: run< ArrayOperationsTester< int, Devices::Host > >() ) return EXIT_FAILURE; return EXIT_SUCCESS; } #include "ArrayOperationsTest.h"