diff options
author | David J. Luitz <tux008@googlemail.com> | 2010-12-30 15:16:23 +0100 |
---|---|---|
committer | David J. Luitz <tux008@googlemail.com> | 2010-12-30 15:16:23 +0100 |
commit | 11e253bc101d804c1e2dfea90f3c8256700324d4 (patch) | |
tree | e93fcfc5ca5cb10a6e3a9472dc096eaefa82b6c5 /test/sparse_product.cpp | |
parent | 13867c15cca7716ff36c2ee2c9b37ebe2721cd9a (diff) |
[Sparse] Added regression tests for the two bugfixes, the code passes all sparse_product tests
Diffstat (limited to 'test/sparse_product.cpp')
-rw-r--r-- | test/sparse_product.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/sparse_product.cpp b/test/sparse_product.cpp index ce42c5f52..da4ecc306 100644 --- a/test/sparse_product.cpp +++ b/test/sparse_product.cpp @@ -137,6 +137,31 @@ template<typename SparseMatrixType> void sparse_product(const SparseMatrixType& } } +// New test for Bug in SparseTimeDenseProduct +template<typename SparseMatrixType, typename DenseMatrixType> void sparse_product_regression_test() +{ + // This code does not compile with afflicted versions of the bug +/* SparseMatrixType sm1(3,2); + DenseMatrixType m2(2,2); + sm1.setZero(); + m2.setZero(); + + DenseMatrixType m3 = sm1*m2; + */ + + + // This code produces a segfault with afflicted versions of another SparseTimeDenseProduct + // bug + + SparseMatrixType sm2(20000,2); + DenseMatrixType m3(2,2); + sm2.setZero(); + m3.setZero(); + DenseMatrixType m4(sm2*m3); + + VERIFY_IS_APPROX( m4(0,0), 0.0 ); +} + void test_sparse_product() { for(int i = 0; i < g_repeat; i++) { @@ -145,5 +170,7 @@ void test_sparse_product() CALL_SUBTEST_1( sparse_product(SparseMatrix<double>(33, 33)) ); CALL_SUBTEST_3( sparse_product(DynamicSparseMatrix<double>(8, 8)) ); + + CALL_SUBTEST_4( (sparse_product_regression_test<SparseMatrix<double,RowMajor>, Matrix<double, Dynamic, Dynamic, RowMajor> >()) ); } } |