Skip to content
Snippets Groups Projects
Commit 8740dfac authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Fixed setDimension, setLike, reset tests.

parent 25467ffc
No related branches found
No related tags found
1 merge request!45Matrices revision
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#ifdef HAVE_GTEST #ifdef HAVE_GTEST
#include <gtest/gtest.h> #include <gtest/gtest.h>
#ifdef NOT_WORKING
// test fixture for typed tests // test fixture for typed tests
template< typename Matrix > template< typename Matrix >
class AdEllpackMatrixTest : public ::testing::Test class AdEllpackMatrixTest : public ::testing::Test
...@@ -58,6 +57,7 @@ using AdEllpackMatrixTypes = ::testing::Types ...@@ -58,6 +57,7 @@ using AdEllpackMatrixTypes = ::testing::Types
TYPED_TEST_SUITE( AdEllpackMatrixTest, AdEllpackMatrixTypes); TYPED_TEST_SUITE( AdEllpackMatrixTest, AdEllpackMatrixTypes);
// WORKING
TYPED_TEST( AdEllpackMatrixTest, setDimensionsTest ) TYPED_TEST( AdEllpackMatrixTest, setDimensionsTest )
{ {
using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType; using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType;
...@@ -65,20 +65,21 @@ TYPED_TEST( AdEllpackMatrixTest, setDimensionsTest ) ...@@ -65,20 +65,21 @@ TYPED_TEST( AdEllpackMatrixTest, setDimensionsTest )
test_SetDimensions< AdEllpackMatrixType >(); test_SetDimensions< AdEllpackMatrixType >();
} }
TYPED_TEST( AdEllpackMatrixTest, setCompressedRowLengthsTest ) //TYPED_TEST( AdEllpackMatrixTest, setCompressedRowLengthsTest )
{ //{
// using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType; //// using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType;
//
// test_SetCompressedRowLengths< AdEllpackMatrixType >(); //// test_SetCompressedRowLengths< AdEllpackMatrixType >();
//
bool testRan = false; // bool testRan = false;
EXPECT_TRUE( testRan ); // EXPECT_TRUE( testRan );
std::cout << "\nTEST DID NOT RUN. NOT WORKING.\n\n"; // std::cout << "\nTEST DID NOT RUN. NOT WORKING.\n\n";
std::cout << " This test is dependent on the input format. \n"; // std::cout << " This test is dependent on the input format. \n";
std::cout << " Almost every format allocates elements per row differently.\n\n"; // std::cout << " Almost every format allocates elements per row differently.\n\n";
std::cout << "\n TODO: Finish implementation of getNonZeroRowLength (Only non-zero elements, not the number of allocated elements.)\n\n"; // std::cout << "\n TODO: Finish implementation of getNonZeroRowLength (Only non-zero elements, not the number of allocated elements.)\n\n";
} //}
// WORKING
TYPED_TEST( AdEllpackMatrixTest, setLikeTest ) TYPED_TEST( AdEllpackMatrixTest, setLikeTest )
{ {
using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType; using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType;
...@@ -86,6 +87,7 @@ TYPED_TEST( AdEllpackMatrixTest, setLikeTest ) ...@@ -86,6 +87,7 @@ TYPED_TEST( AdEllpackMatrixTest, setLikeTest )
test_SetLike< AdEllpackMatrixType, AdEllpackMatrixType >(); test_SetLike< AdEllpackMatrixType, AdEllpackMatrixType >();
} }
// WORKING
TYPED_TEST( AdEllpackMatrixTest, resetTest ) TYPED_TEST( AdEllpackMatrixTest, resetTest )
{ {
using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType; using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType;
...@@ -93,8 +95,12 @@ TYPED_TEST( AdEllpackMatrixTest, resetTest ) ...@@ -93,8 +95,12 @@ TYPED_TEST( AdEllpackMatrixTest, resetTest )
test_Reset< AdEllpackMatrixType >(); test_Reset< AdEllpackMatrixType >();
} }
#ifdef NOT_WORKING
TYPED_TEST( AdEllpackMatrixTest, setElementTest ) TYPED_TEST( AdEllpackMatrixTest, setElementTest )
{ {
// This test fails on m.setCompressedRowLengths( rowLengths ) in SparseMatrixTest.hpp
using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType; using AdEllpackMatrixType = typename TestFixture::AdEllpackMatrixType;
test_SetElement< AdEllpackMatrixType >(); test_SetElement< AdEllpackMatrixType >();
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#ifdef HAVE_GTEST #ifdef HAVE_GTEST
#include <gtest/gtest.h> #include <gtest/gtest.h>
#ifdef NOT_WORKING
// test fixture for typed tests // test fixture for typed tests
template< typename Matrix > template< typename Matrix >
class BiEllpackMatrixTest : public ::testing::Test class BiEllpackMatrixTest : public ::testing::Test
...@@ -39,25 +38,26 @@ using BiEllpackMatrixTypes = ::testing::Types ...@@ -39,25 +38,26 @@ using BiEllpackMatrixTypes = ::testing::Types
TNL::Matrices::BiEllpack< int, TNL::Devices::Host, long >, TNL::Matrices::BiEllpack< int, TNL::Devices::Host, long >,
TNL::Matrices::BiEllpack< long, TNL::Devices::Host, long >, TNL::Matrices::BiEllpack< long, TNL::Devices::Host, long >,
TNL::Matrices::BiEllpack< float, TNL::Devices::Host, long >, TNL::Matrices::BiEllpack< float, TNL::Devices::Host, long >,
TNL::Matrices::BiEllpack< double, TNL::Devices::Host, long >//, TNL::Matrices::BiEllpack< double, TNL::Devices::Host, long >,
//#ifdef HAVE_CUDA #ifdef HAVE_CUDA
// TNL::Matrices::BiEllpack< int, TNL::Devices::Cuda, short >, TNL::Matrices::BiEllpack< int, TNL::Devices::Cuda, short >,
// TNL::Matrices::BiEllpack< long, TNL::Devices::Cuda, short >, TNL::Matrices::BiEllpack< long, TNL::Devices::Cuda, short >,
// TNL::Matrices::BiEllpack< float, TNL::Devices::Cuda, short >, TNL::Matrices::BiEllpack< float, TNL::Devices::Cuda, short >,
// TNL::Matrices::BiEllpack< double, TNL::Devices::Cuda, short >, TNL::Matrices::BiEllpack< double, TNL::Devices::Cuda, short >,
// TNL::Matrices::BiEllpack< int, TNL::Devices::Cuda, int >, TNL::Matrices::BiEllpack< int, TNL::Devices::Cuda, int >,
// TNL::Matrices::BiEllpack< long, TNL::Devices::Cuda, int >, TNL::Matrices::BiEllpack< long, TNL::Devices::Cuda, int >,
// TNL::Matrices::BiEllpack< float, TNL::Devices::Cuda, int >, TNL::Matrices::BiEllpack< float, TNL::Devices::Cuda, int >,
// TNL::Matrices::BiEllpack< double, TNL::Devices::Cuda, int >, TNL::Matrices::BiEllpack< double, TNL::Devices::Cuda, int >,
// TNL::Matrices::BiEllpack< int, TNL::Devices::Cuda, long >, TNL::Matrices::BiEllpack< int, TNL::Devices::Cuda, long >,
// TNL::Matrices::BiEllpack< long, TNL::Devices::Cuda, long >, TNL::Matrices::BiEllpack< long, TNL::Devices::Cuda, long >,
// TNL::Matrices::BiEllpack< float, TNL::Devices::Cuda, long >, TNL::Matrices::BiEllpack< float, TNL::Devices::Cuda, long >,
// TNL::Matrices::BiEllpack< double, TNL::Devices::Cuda, long > TNL::Matrices::BiEllpack< double, TNL::Devices::Cuda, long >
//#endif #endif
>; >;
TYPED_TEST_SUITE( BiEllpackMatrixTest, BiEllpackMatrixTypes); TYPED_TEST_SUITE( BiEllpackMatrixTest, BiEllpackMatrixTypes);
// WORKING
TYPED_TEST( BiEllpackMatrixTest, setDimensionsTest ) TYPED_TEST( BiEllpackMatrixTest, setDimensionsTest )
{ {
using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType; using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType;
...@@ -65,20 +65,21 @@ TYPED_TEST( BiEllpackMatrixTest, setDimensionsTest ) ...@@ -65,20 +65,21 @@ TYPED_TEST( BiEllpackMatrixTest, setDimensionsTest )
test_SetDimensions< BiEllpackMatrixType >(); test_SetDimensions< BiEllpackMatrixType >();
} }
TYPED_TEST( BiEllpackMatrixTest, setCompressedRowLengthsTest ) //TYPED_TEST( BiEllpackMatrixTest, setCompressedRowLengthsTest )
{ //{
// using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType; //// using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType;
//
// test_SetCompressedRowLengths< BiEllpackMatrixType >(); //// test_SetCompressedRowLengths< BiEllpackMatrixType >();
//
bool testRan = false; // bool testRan = false;
EXPECT_TRUE( testRan ); // EXPECT_TRUE( testRan );
std::cout << "\nTEST DID NOT RUN. NOT WORKING.\n\n"; // std::cout << "\nTEST DID NOT RUN. NOT WORKING.\n\n";
std::cout << " This test is dependent on the input format. \n"; // std::cout << " This test is dependent on the input format. \n";
std::cout << " Almost every format allocates elements per row differently.\n\n"; // std::cout << " Almost every format allocates elements per row differently.\n\n";
std::cout << "\n TODO: Finish implementation of getNonZeroRowLength (Only non-zero elements, not the number of allocated elements.)\n\n"; // std::cout << "\n TODO: Finish implementation of getNonZeroRowLength (Only non-zero elements, not the number of allocated elements.)\n\n";
} //}
// WORKING
TYPED_TEST( BiEllpackMatrixTest, setLikeTest ) TYPED_TEST( BiEllpackMatrixTest, setLikeTest )
{ {
using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType; using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType;
...@@ -86,6 +87,7 @@ TYPED_TEST( BiEllpackMatrixTest, setLikeTest ) ...@@ -86,6 +87,7 @@ TYPED_TEST( BiEllpackMatrixTest, setLikeTest )
test_SetLike< BiEllpackMatrixType, BiEllpackMatrixType >(); test_SetLike< BiEllpackMatrixType, BiEllpackMatrixType >();
} }
// WORKING
TYPED_TEST( BiEllpackMatrixTest, resetTest ) TYPED_TEST( BiEllpackMatrixTest, resetTest )
{ {
using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType; using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType;
...@@ -93,8 +95,12 @@ TYPED_TEST( BiEllpackMatrixTest, resetTest ) ...@@ -93,8 +95,12 @@ TYPED_TEST( BiEllpackMatrixTest, resetTest )
test_Reset< BiEllpackMatrixType >(); test_Reset< BiEllpackMatrixType >();
} }
#ifdef NOT_WORKING
TYPED_TEST( BiEllpackMatrixTest, setElementTest ) TYPED_TEST( BiEllpackMatrixTest, setElementTest )
{ {
// This test will segfault in the first test where Device is Cuda.
// This test doesn't return the correct values.
using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType; using BiEllpackMatrixType = typename TestFixture::BiEllpackMatrixType;
test_SetElement< BiEllpackMatrixType >(); test_SetElement< BiEllpackMatrixType >();
......
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