Skip to content

Commit

Permalink
Add test for old coo2csr.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelesh committed Sep 12, 2024
1 parent 563940c commit ee813ce
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 19 additions & 1 deletion tests/unit/matrix/MatrixConversionTests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MatrixConversionTests : TestBase
MatrixConversionTests(){}
virtual ~MatrixConversionTests(){}

TestOutcome cooToCsr()
TestOutcome newCooToCsr()
{
TestStatus status;
status = true;
Expand All @@ -33,6 +33,24 @@ class MatrixConversionTests : TestBase
return status.report(__func__);
}

TestOutcome oldCooToCsr()
{
TestStatus status;
status.expectFailure();

matrix::Coo* A = createSymmetricCooMatrix();
ReSolve::matrix::Csr* A_csr = new matrix::Csr(A->getNumRows(), A->getNumColumns(), 0);

int retval = coo2csr(A, A_csr, memory::HOST);

status *= verifyAnswer(*A_csr, symmetric_expanded_csr_matrix_rows_, symmetric_expanded_csr_matrix_cols_, symmetric_expanded_csr_matrix_vals_);

delete A;
delete A_csr;

return status.report(__func__);
}

private:

bool verifyAnswer(/* const */ ReSolve::matrix::Csr& answer,
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/matrix/runMatrixConversionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ int main(int, char**)
ReSolve::tests::MatrixConversionTests test;

ReSolve::tests::TestingResults result;
result += test.cooToCsr();
result += test.newCooToCsr();
result += test.oldCooToCsr();

return result.summary();
}

0 comments on commit ee813ce

Please sign in to comment.