From cef6bace2aad3d7892c58a4a61e2ab9978f951fe Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 5 Mar 2004 13:59:50 +0000 Subject: [PATCH] Add new test. git-svn-id: https://svn.dealii.org/trunk@8666 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/bits/sparse_matrix_iterator_01.cc | 80 +++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tests/bits/sparse_matrix_iterator_01.cc diff --git a/tests/bits/sparse_matrix_iterator_01.cc b/tests/bits/sparse_matrix_iterator_01.cc new file mode 100644 index 0000000000..d74a7ece48 --- /dev/null +++ b/tests/bits/sparse_matrix_iterator_01.cc @@ -0,0 +1,80 @@ +//---------------------------- sparse_matrix_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- sparse_matrix_01.cc --------------------------- + + +// SparseMatrix::const_iterator::operator++(int) was declared but not defined +// for some time, leading to a linker error + +#include "../tests.h" +#include +#include +#include + + +void test () +{ + SparsityPattern sp (5,5,3); + for (unsigned int i=0; i<5; ++i) + for (unsigned int j=0; j<5; ++j) + if ((i+2*j+1) % 3 == 0) + sp.add (i,j); + sp.compress (); + + SparseMatrix m(sp); + SparseMatrix::const_iterator i = m.begin(); + deallog << i->value() << std::endl; + ++i; + deallog << i->value() << std::endl; + i++; + deallog << i->value() << std::endl; + + deallog << "OK" << std::endl; +} + + + +int main () +{ + std::ofstream logfile("sparse_matrix_iterator_01.output"); + deallog.attach(logfile); + deallog.depth_console(0); + + try + { + test (); + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + }; +} -- 2.39.5