]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 2 Mar 2005 00:46:19 +0000 (00:46 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 2 Mar 2005 00:46:19 +0000 (00:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@9942 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/sparse_matrix_iterator_12.cc [new file with mode: 0644]

diff --git a/tests/bits/sparse_matrix_iterator_12.cc b/tests/bits/sparse_matrix_iterator_12.cc
new file mode 100644 (file)
index 0000000..95d7073
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  sparse_matrix_iterator_12.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_12.cc  ---------------------------
+
+
+// like sparse_matrix_iterator_11, but for const_iterators
+
+#include "../tests.h"
+#include <lac/sparsity_pattern.h>
+#include <lac/sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+
+
+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<double> A(sparsity);
+
+  SparseMatrix<double>::const_iterator k = A.begin(),
+                                       j = ++A.begin();
+
+  Assert (k < j, ExcInternalError());
+  Assert (j > k, ExcInternalError());
+
+  Assert (!(j < k), ExcInternalError());
+  Assert (!(k > j), ExcInternalError());
+
+  Assert (k != j, ExcInternalError());
+  Assert (!(k == j), ExcInternalError());
+
+  Assert (k == k, ExcInternalError());
+  Assert (!(k != k), ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("sparse_matrix_iterator_12.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;
+    };
+}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.