diff --git a/src/UnitTests/Containers/CMakeLists.txt b/src/UnitTests/Containers/CMakeLists.txt index 6ff7570dd3b1a62051ce295180205ddac0675156..70014014ae6c0e793ed041c631f8b5185a5f7d2a 100644 --- a/src/UnitTests/Containers/CMakeLists.txt +++ b/src/UnitTests/Containers/CMakeLists.txt @@ -68,6 +68,10 @@ ADD_EXECUTABLE( StaticVectorOperationsTest StaticVectorOperationsTest.cpp ) TARGET_COMPILE_OPTIONS( StaticVectorOperationsTest PRIVATE ${CXX_TESTS_FLAGS} ) TARGET_LINK_LIBRARIES( StaticVectorOperationsTest ${GTEST_BOTH_LIBRARIES} ) +ADD_EXECUTABLE( VectorOfStaticVectorsTest VectorOfStaticVectorsTest.cpp ) +TARGET_COMPILE_OPTIONS( VectorOfStaticVectorsTest PRIVATE ${CXX_TESTS_FLAGS} ) +TARGET_LINK_LIBRARIES( VectorOfStaticVectorsTest ${GTEST_BOTH_LIBRARIES} ) + ADD_TEST( ArrayTest ${EXECUTABLE_OUTPUT_PATH}/ArrayTest${CMAKE_EXECUTABLE_SUFFIX} ) ADD_TEST( ArrayViewTest ${EXECUTABLE_OUTPUT_PATH}/ArrayViewTest${CMAKE_EXECUTABLE_SUFFIX} ) @@ -90,6 +94,7 @@ ENDIF() ADD_TEST( StaticArrayTest ${EXECUTABLE_OUTPUT_PATH}/StaticArrayTest${CMAKE_EXECUTABLE_SUFFIX} ) ADD_TEST( StaticVectorTest ${EXECUTABLE_OUTPUT_PATH}/StaticVectorTest${CMAKE_EXECUTABLE_SUFFIX} ) ADD_TEST( StaticVectorOperationsTest ${EXECUTABLE_OUTPUT_PATH}/StaticVectorOperationsTest${CMAKE_EXECUTABLE_SUFFIX} ) +ADD_TEST( VectorOfStaticVectorsTest ${EXECUTABLE_OUTPUT_PATH}/VectorOfStaticVectorsTest${CMAKE_EXECUTABLE_SUFFIX} ) ADD_SUBDIRECTORY( Multimaps ) diff --git a/src/UnitTests/Containers/VectorBinaryOperationsTest.h b/src/UnitTests/Containers/VectorBinaryOperationsTest.h index bae5ce5f389e703711df651084994c8f39775116..3c899cc5120d4885a49a3d6037129eb372b0a83e 100644 --- a/src/UnitTests/Containers/VectorBinaryOperationsTest.h +++ b/src/UnitTests/Containers/VectorBinaryOperationsTest.h @@ -21,6 +21,9 @@ #elif defined(STATIC_VECTOR) #include <TNL/Containers/StaticVector.h> #else + #ifdef VECTOR_OF_STATIC_VECTORS + #include <TNL/Containers/StaticVector.h> + #endif #include <TNL/Containers/Vector.h> #include <TNL/Containers/VectorView.h> #endif @@ -189,37 +192,53 @@ protected: Pair< StaticVector< 5, double >, StaticVector< 5, double > > >; #else - using VectorPairs = ::testing::Types< - #ifndef HAVE_CUDA - Pair< Vector< int, Devices::Host >, Vector< int, Devices::Host > >, - Pair< VectorView< int, Devices::Host >, Vector< int, Devices::Host > >, - Pair< VectorView< const int, Devices::Host >, Vector< int, Devices::Host > >, - Pair< Vector< int, Devices::Host >, VectorView< int, Devices::Host > >, - Pair< Vector< int, Devices::Host >, VectorView< const int, Devices::Host > >, - Pair< VectorView< int, Devices::Host >, VectorView< int, Devices::Host > >, - Pair< VectorView< const int, Devices::Host >, VectorView< int, Devices::Host > >, - Pair< VectorView< const int, Devices::Host >, VectorView< const int, Devices::Host > >, - Pair< VectorView< int, Devices::Host >, VectorView< const int, Devices::Host > >, - Pair< Vector< double, Devices::Host >, Vector< double, Devices::Host > >, - Pair< VectorView< double, Devices::Host >, Vector< double, Devices::Host > >, - Pair< Vector< double, Devices::Host >, VectorView< double, Devices::Host > >, - Pair< VectorView< double, Devices::Host >, VectorView< double, Devices::Host > > + #ifdef VECTOR_OF_STATIC_VECTORS + using VectorPairs = ::testing::Types< + #ifndef HAVE_CUDA + Pair< Vector< StaticVector< 3, double >, Devices::Host >, Vector< StaticVector< 3, double >, Devices::Host > >, + Pair< VectorView< StaticVector< 3, double >, Devices::Host >, Vector< StaticVector< 3, double >, Devices::Host > >, + Pair< Vector< StaticVector< 3, double >, Devices::Host >, VectorView< StaticVector< 3, double >, Devices::Host > >, + Pair< VectorView< StaticVector< 3, double >, Devices::Host >, VectorView< StaticVector< 3, double >, Devices::Host > > + #else + Pair< Vector< StaticVector< 3, double >, Devices::Cuda >, Vector< StaticVector< 3, double >, Devices::Cuda > >, + Pair< VectorView< StaticVector< 3, double >, Devices::Cuda >, Vector< StaticVector< 3, double >, Devices::Cuda > >, + Pair< Vector< StaticVector< 3, double >, Devices::Cuda >, VectorView< StaticVector< 3, double >, Devices::Cuda > >, + Pair< VectorView< StaticVector< 3, double >, Devices::Cuda >, VectorView< StaticVector< 3, double >, Devices::Cuda > > + #endif + >; #else - Pair< Vector< int, Devices::Cuda >, Vector< int, Devices::Cuda > >, - Pair< VectorView< int, Devices::Cuda >, Vector< int, Devices::Cuda > >, - Pair< VectorView< const int, Devices::Cuda >, Vector< int, Devices::Cuda > >, - Pair< Vector< int, Devices::Cuda >, VectorView< int, Devices::Cuda > >, - Pair< Vector< int, Devices::Cuda >, VectorView< const int, Devices::Cuda > >, - Pair< VectorView< int, Devices::Cuda >, VectorView< int, Devices::Cuda > >, - Pair< VectorView< const int, Devices::Cuda >, VectorView< int, Devices::Cuda > >, - Pair< VectorView< const int, Devices::Cuda >, VectorView< const int, Devices::Cuda > >, - Pair< VectorView< int, Devices::Cuda >, VectorView< const int, Devices::Cuda > >, - Pair< Vector< double, Devices::Cuda >, Vector< double, Devices::Cuda > >, - Pair< VectorView< double, Devices::Cuda >, Vector< double, Devices::Cuda > >, - Pair< Vector< double, Devices::Cuda >, VectorView< double, Devices::Cuda > >, - Pair< VectorView< double, Devices::Cuda >, VectorView< double, Devices::Cuda > > + using VectorPairs = ::testing::Types< + #ifndef HAVE_CUDA + Pair< Vector< int, Devices::Host >, Vector< int, Devices::Host > >, + Pair< VectorView< int, Devices::Host >, Vector< int, Devices::Host > >, + Pair< VectorView< const int, Devices::Host >, Vector< int, Devices::Host > >, + Pair< Vector< int, Devices::Host >, VectorView< int, Devices::Host > >, + Pair< Vector< int, Devices::Host >, VectorView< const int, Devices::Host > >, + Pair< VectorView< int, Devices::Host >, VectorView< int, Devices::Host > >, + Pair< VectorView< const int, Devices::Host >, VectorView< int, Devices::Host > >, + Pair< VectorView< const int, Devices::Host >, VectorView< const int, Devices::Host > >, + Pair< VectorView< int, Devices::Host >, VectorView< const int, Devices::Host > >, + Pair< Vector< double, Devices::Host >, Vector< double, Devices::Host > >, + Pair< VectorView< double, Devices::Host >, Vector< double, Devices::Host > >, + Pair< Vector< double, Devices::Host >, VectorView< double, Devices::Host > >, + Pair< VectorView< double, Devices::Host >, VectorView< double, Devices::Host > > + #else + Pair< Vector< int, Devices::Cuda >, Vector< int, Devices::Cuda > >, + Pair< VectorView< int, Devices::Cuda >, Vector< int, Devices::Cuda > >, + Pair< VectorView< const int, Devices::Cuda >, Vector< int, Devices::Cuda > >, + Pair< Vector< int, Devices::Cuda >, VectorView< int, Devices::Cuda > >, + Pair< Vector< int, Devices::Cuda >, VectorView< const int, Devices::Cuda > >, + Pair< VectorView< int, Devices::Cuda >, VectorView< int, Devices::Cuda > >, + Pair< VectorView< const int, Devices::Cuda >, VectorView< int, Devices::Cuda > >, + Pair< VectorView< const int, Devices::Cuda >, VectorView< const int, Devices::Cuda > >, + Pair< VectorView< int, Devices::Cuda >, VectorView< const int, Devices::Cuda > >, + Pair< Vector< double, Devices::Cuda >, Vector< double, Devices::Cuda > >, + Pair< VectorView< double, Devices::Cuda >, Vector< double, Devices::Cuda > >, + Pair< Vector< double, Devices::Cuda >, VectorView< double, Devices::Cuda > >, + Pair< VectorView< double, Devices::Cuda >, VectorView< double, Devices::Cuda > > + #endif + >; #endif - >; #endif TYPED_TEST_SUITE( VectorBinaryOperationsTest, VectorPairs ); diff --git a/src/UnitTests/Containers/VectorOfStaticVectorsTest.cpp b/src/UnitTests/Containers/VectorOfStaticVectorsTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5c7cd923c76761feb89f140494b682fb167d754a --- /dev/null +++ b/src/UnitTests/Containers/VectorOfStaticVectorsTest.cpp @@ -0,0 +1,5 @@ +#define VECTOR_OF_STATIC_VECTORS +//#include "VectorBinaryOperationsTest.h" +//#include "VectorUnaryOperationsTest.h" +//#include "VectorVerticalOperationsTest.h" +#include "../main.h" diff --git a/src/UnitTests/Containers/VectorUnaryOperationsTest.h b/src/UnitTests/Containers/VectorUnaryOperationsTest.h index 827147cd53552209f9875370b93ca75d7514728a..4440521d1eb780e1f0fa5b7db6e2b97c626baf1d 100644 --- a/src/UnitTests/Containers/VectorUnaryOperationsTest.h +++ b/src/UnitTests/Containers/VectorUnaryOperationsTest.h @@ -21,6 +21,9 @@ #elif defined(STATIC_VECTOR) #include <TNL/Containers/StaticVector.h> #else + #ifdef VECTOR_OF_STATIC_VECTORS + #include <TNL/Containers/StaticVector.h> + #endif #include <TNL/Containers/Vector.h> #include <TNL/Containers/VectorView.h> #endif @@ -94,22 +97,34 @@ protected: StaticVector< 5, double > >; #else - using VectorTypes = ::testing::Types< - #ifndef HAVE_CUDA - Vector< int, Devices::Host >, - VectorView< int, Devices::Host >, - VectorView< const int, Devices::Host >, - Vector< double, Devices::Host >, - VectorView< double, Devices::Host > - #endif - #ifdef HAVE_CUDA - Vector< int, Devices::Cuda >, - VectorView< int, Devices::Cuda >, - VectorView< const int, Devices::Cuda >, - Vector< double, Devices::Cuda >, - VectorView< double, Devices::Cuda > + #ifdef VECTOR_OF_STATIC_VECTORS + using VectorTypes = ::testing::Types< + #ifndef HAVE_CUDA + Vector< StaticVector< 3, double >, Devices::Host >, + VectorView< StaticVector< 3, double >, Devices::Host > + #else + Vector< StaticVector< 3, double >, Devices::Cuda >, + VectorView< StaticVector< 3, double >, Devices::Cuda > + #endif + >; + #else + using VectorTypes = ::testing::Types< + #ifndef HAVE_CUDA + Vector< int, Devices::Host >, + VectorView< int, Devices::Host >, + VectorView< const int, Devices::Host >, + Vector< double, Devices::Host >, + VectorView< double, Devices::Host > + #endif + #ifdef HAVE_CUDA + Vector< int, Devices::Cuda >, + VectorView< int, Devices::Cuda >, + VectorView< const int, Devices::Cuda >, + Vector< double, Devices::Cuda >, + VectorView< double, Devices::Cuda > + #endif + >; #endif - >; #endif TYPED_TEST_SUITE( VectorUnaryOperationsTest, VectorTypes ); diff --git a/src/UnitTests/Containers/VectorVerticalOperationsTest.h b/src/UnitTests/Containers/VectorVerticalOperationsTest.h index 93ff286ae65fb5b9dc170903d6aeb16032ebaa69..a21c235bdd2db6c52b61d8d3f86c8b73dee7ac58 100644 --- a/src/UnitTests/Containers/VectorVerticalOperationsTest.h +++ b/src/UnitTests/Containers/VectorVerticalOperationsTest.h @@ -21,6 +21,9 @@ #elif defined(STATIC_VECTOR) #include <TNL/Containers/StaticVector.h> #else + #ifdef VECTOR_OF_STATIC_VECTORS + #include <TNL/Containers/StaticVector.h> + #endif #include <TNL/Containers/Vector.h> #include <TNL/Containers/VectorView.h> #endif @@ -133,22 +136,34 @@ protected: StaticVector< 5, double > >; #else - using VectorTypes = ::testing::Types< - #ifndef HAVE_CUDA - Vector< int, Devices::Host >, - VectorView< int, Devices::Host >, - VectorView< const int, Devices::Host >, - Vector< double, Devices::Host >, - VectorView< double, Devices::Host > - #endif - #ifdef HAVE_CUDA - Vector< int, Devices::Cuda >, - VectorView< int, Devices::Cuda >, - VectorView< const int, Devices::Cuda >, - Vector< double, Devices::Cuda >, - VectorView< double, Devices::Cuda > + #ifdef VECTOR_OF_STATIC_VECTORS + using VectorTypes = ::testing::Types< + #ifndef HAVE_CUDA + Vector< StaticVector< 3, double >, Devices::Host >, + VectorView< StaticVector< 3, double >, Devices::Host > + #else + Vector< StaticVector< 3, double >, Devices::Cuda >, + VectorView< StaticVector< 3, double >, Devices::Cuda > + #endif + >; + #else + using VectorTypes = ::testing::Types< + #ifndef HAVE_CUDA + Vector< int, Devices::Host >, + VectorView< int, Devices::Host >, + VectorView< const int, Devices::Host >, + Vector< double, Devices::Host >, + VectorView< double, Devices::Host > + #endif + #ifdef HAVE_CUDA + Vector< int, Devices::Cuda >, + VectorView< int, Devices::Cuda >, + VectorView< const int, Devices::Cuda >, + Vector< double, Devices::Cuda >, + VectorView< double, Devices::Cuda > + #endif + >; #endif - >; #endif TYPED_TEST_SUITE( VectorVerticalOperationsTest, VectorTypes );