Commit ccec6bd7 authored by Lukas Cejka's avatar Lukas Cejka
Browse files

Adding commented-out, provisional and non-functioning test for vectorProduct...

Adding commented-out, provisional and non-functioning test for vectorProduct function. Adding only for backup purposes.
parent 4a323ad9
Loading
Loading
Loading
Loading
+88 −27
Original line number Diff line number Diff line
@@ -340,6 +340,55 @@ void test_SetRow()
    EXPECT_EQ( m.getElement( 2, 6 ),  0 );
}

template< typename Matrix >
void test_VectorProduct()
{
/*
 * Sets up the following 5x4 sparse matrix:
 *
 *    /  1  2  3  0 \
 *    |  0  0  0  4 |
 *    |  5  6  7  0 |
 *    |  0  8  9 10 |
 *    \  0  0 11 12 /
 */
//    const int m_rows = 5;
//    const int m_cols = 4;
//    
//    Matrix m;
//    m.reset();
//    m.setDimensions( m_rows, m_cols );
//    typename Matrix::CompressedRowLengthsVector rowLengths;
//    rowLengths.setSize( m_rows );
//    rowLengths.setValue( 4 );
//    m.setCompressedRowLengths( rowLengths );
//    
//    int value = 1;
//    for( int i = 0; i < m_cols - 1; i++ )   // 0th row
//        m.setElement( 0, i, value++ );
//    
//        m.setElement( 1, 3, value++ );      // 1st row
//        
//    for( int i = 0; i < m_cols - 1; i++ )   // 2nd row
//        m.setElement( 2, i, value++ );
//        
//    for( int i = 1; i < m_cols; i++ )       // 3rd row
//        m.setElement( 3, i, value++ );
//        
//    for( int i = 2; i < m_cols; i++ )       // 4th row
//        m.setElement( 4, i, value++ );
//        
//    const int inVector [ 5 ] = { 1, 1, 1, 1, 1 };
//    int outVector [ 4 ] = { 0, 0, 0, 0 };
//    
//    m.vectorProduct( inVector, outVector);
//    
//    EXPECT_EQ( outVector[0],  6 );
//    EXPECT_EQ( outVector[1], 16 );
//    EXPECT_EQ( outVector[2], 30 );
//    EXPECT_EQ( outVector[3], 26 );
}

TEST( SparseMatrixTest, CSR_GetTypeTest_Host )
{
   host_test_GetType< CSR_host_float, CSR_host_int >();
@@ -436,6 +485,18 @@ TEST( SparseMatrixTest, CSR_setRowTest_Cuda )
}
#endif

TEST( SparseMatrixTest, CSR_vectorProductTest_Host )
{
    test_VectorProduct< CSR_host_int >();
}

#ifdef HAVE_CUDA
TEST( SparseMatrixTest, CSR_vectorProductTest_Cuda )
{
    test_VectorProduct< CSR_cuda_int >();
}
#endif

#endif

#include "../GtestMissingError.h"