Commit 58d753b0 authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Added test for setLike function, but only for Dimension comparison.

	Added TODOs to implement rowPointer test for
setCompressedRowLengths and setDimensions test functions.
parent cab34280
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ void test_SetDimensions()
    
    EXPECT_EQ( m.getRows(), 9);
    EXPECT_EQ( m.getColumns(), 8);
    
    // TODO: Implement rowPointers test.
}

template< typename Matrix >
@@ -86,6 +88,31 @@ void test_SetCompressedRowLengths()
    EXPECT_EQ( m.getRowLength( 7), 6 );
    EXPECT_EQ( m.getRowLength( 8), 7 );
    EXPECT_EQ( m.getRowLength( 9), 8 );
    
    // TOOD: Implement rowPointers test.
}

template< typename Matrix1, typename Matrix2 >
void test_SetLike()
{
    const int rows = 8;
    const int cols = 7;
    
    Matrix1 m1;
    m1.reset();
    m1.setDimensions( rows + 1, cols + 2 );
    
    Matrix2 m2;
    m2.reset();
    m2.setDimensions( rows, cols );
    
    m1.setLike( m2 );
    
    EXPECT_EQ( m1.getRows(), m2.getRows() );
    EXPECT_EQ( m1.getColumns(), m2.getColumns() );
    
    // TODO: Implement number of matrix elements test.
    // TOOD: Implement rowPointers test.
}

TEST( SparseMatrixTest, CSR_GetTypeTest_Host )
@@ -124,6 +151,18 @@ TEST( SparseMatrixTest, CSR_setCompressedRowLengthsTest_Cuda )
}
#endif

TEST( SparseMatrixTest, CSR_setLikeTest_Host )
{
   test_SetLike< CSR_host_int, CSR_host_float >();
}

#ifdef HAVE_CUDA
TEST( SparseMatrixTest, CSR_setLikeTest_Cuda )
{
   test_SetLike< CSR_cuda_int, CSR_cuda_float >();
}
#endif

#endif

#include "../GtestMissingError.h"