From: Wolfgang Bangerth Date: Wed, 2 Mar 2005 00:27:36 +0000 (+0000) Subject: New test, making sure comparisons between sparse matrix iterators work as X-Git-Tag: v8.0.0~14570 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=205547c9d2374779e502c9ea783a59abbc9c5b0d;p=dealii.git New test, making sure comparisons between sparse matrix iterators work as expected. git-svn-id: https://svn.dealii.org/trunk@9938 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/sparse_matrix_iterator_11.cc b/tests/bits/sparse_matrix_iterator_11.cc new file mode 100644 index 0000000000..6acc1c1475 --- /dev/null +++ b/tests/bits/sparse_matrix_iterator_11.cc @@ -0,0 +1,84 @@ +//---------------------------- sparse_matrix_iterator_11.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005 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_iterator_11.cc --------------------------- + + +// certain comparisons between sparse matrix iterators didn't compile. + +#include "../tests.h" +#include +#include +#include +#include + + +void test () +{ + // create a sparsity pattern with totally + // empty lines (not even diagonals, since + // not quadratic) + SparsityPattern sparsity(4,5,1); + sparsity.add (1,1); + sparsity.add (3,1); + sparsity.compress (); + + // attach a sparse matrix to it + SparseMatrix A(sparsity); + + SparseMatrix::iterator k = A.begin(), + j = k++; + Assert (k < j, ExcInternalError()); + Assert (k != j, ExcInternalError()); + + Assert (!(j < k), ExcInternalError()); + Assert (!(k == j), ExcInternalError()); + + deallog << "OK" << std::endl; +} + + + +int main () +{ + std::ofstream logfile("sparse_matrix_iterator_11.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; + }; +}