]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a few tests.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 1 Nov 2018 14:23:07 +0000 (08:23 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 1 Nov 2018 14:23:07 +0000 (08:23 -0600)
tests/sparsity/dynamic_sparsity_pattern_iterator_07.cc [new file with mode: 0644]
tests/sparsity/dynamic_sparsity_pattern_iterator_07.output [new file with mode: 0644]
tests/sparsity/dynamic_sparsity_pattern_iterator_08.cc [new file with mode: 0644]
tests/sparsity/dynamic_sparsity_pattern_iterator_08.output [new file with mode: 0644]
tests/sparsity/sparsity_pattern_iterator_07.cc [new file with mode: 0644]
tests/sparsity/sparsity_pattern_iterator_07.output [new file with mode: 0644]
tests/sparsity/sparsity_pattern_iterator_08.cc [new file with mode: 0644]
tests/sparsity/sparsity_pattern_iterator_08.output [new file with mode: 0644]

diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_07.cc b/tests/sparsity/dynamic_sparsity_pattern_iterator_07.cc
new file mode 100644 (file)
index 0000000..94e3af2
--- /dev/null
@@ -0,0 +1,77 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2004 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// test that DynamicSparsityPattern::iterator yields something
+// sensible for empty sparsity patterns
+
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
+
+#include "../tests.h"
+
+
+void
+test()
+{
+  DynamicSparsityPattern sp(5, 5);
+  // put nothing into the sparsity pattern
+  sp.compress();
+
+  DynamicSparsityPattern::const_iterator i = sp.begin();
+  for (; i != sp.end(); ++i)
+    deallog << i->row() << ' ' << i->column() << std::endl;
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int
+main()
+{
+  initlog();
+
+  try
+    {
+      test();
+    }
+  catch (std::exception &exc)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Exception on processing: " << std::endl
+              << exc.what() << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+
+      return 1;
+    }
+  catch (...)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Unknown exception!" << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_07.output b/tests/sparsity/dynamic_sparsity_pattern_iterator_07.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_08.cc b/tests/sparsity/dynamic_sparsity_pattern_iterator_08.cc
new file mode 100644 (file)
index 0000000..288d600
--- /dev/null
@@ -0,0 +1,77 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2004 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// test that DynamicSparsityPattern::iterator yields something
+// sensible for empty sparsity patterns with zero rows/columns
+
+#include <deal.II/lac/dynamic_sparsity_pattern.h>
+
+#include "../tests.h"
+
+
+void
+test()
+{
+  DynamicSparsityPattern sp;
+  // put nothing into the sparsity pattern
+  sp.compress();
+
+  DynamicSparsityPattern::const_iterator i = sp.begin();
+  for (; i != sp.end(); ++i)
+    deallog << i->row() << ' ' << i->column() << std::endl;
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int
+main()
+{
+  initlog();
+
+  try
+    {
+      test();
+    }
+  catch (std::exception &exc)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Exception on processing: " << std::endl
+              << exc.what() << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+
+      return 1;
+    }
+  catch (...)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Unknown exception!" << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/sparsity/dynamic_sparsity_pattern_iterator_08.output b/tests/sparsity/dynamic_sparsity_pattern_iterator_08.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/sparsity/sparsity_pattern_iterator_07.cc b/tests/sparsity/sparsity_pattern_iterator_07.cc
new file mode 100644 (file)
index 0000000..3508125
--- /dev/null
@@ -0,0 +1,79 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2004 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// test that SparsityPattern::iterator yields something
+// sensible for empty sparsity patterns
+
+#include <deal.II/lac/sparsity_pattern.h>
+
+#include "../tests.h"
+
+
+void
+test()
+{
+  // use a non-square sparsity pattern to make sure the object does
+  // not automatically store the diagonals
+  SparsityPattern sp(5, 6, 3);
+  // put nothing into the sparsity pattern
+  sp.compress();
+
+  SparsityPattern::const_iterator i = sp.begin();
+  for (; i != sp.end(); ++i)
+    deallog << i->row() << ' ' << i->column() << std::endl;
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int
+main()
+{
+  initlog();
+
+  try
+    {
+      test();
+    }
+  catch (std::exception &exc)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Exception on processing: " << std::endl
+              << exc.what() << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+
+      return 1;
+    }
+  catch (...)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Unknown exception!" << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/sparsity/sparsity_pattern_iterator_07.output b/tests/sparsity/sparsity_pattern_iterator_07.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/sparsity/sparsity_pattern_iterator_08.cc b/tests/sparsity/sparsity_pattern_iterator_08.cc
new file mode 100644 (file)
index 0000000..1461a11
--- /dev/null
@@ -0,0 +1,77 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2004 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// test that SparsityPattern::iterator yields something
+// sensible for empty sparsity patterns with zero rows/columns
+
+#include <deal.II/lac/sparsity_pattern.h>
+
+#include "../tests.h"
+
+
+void
+test()
+{
+  SparsityPattern sp;
+  // put nothing into the sparsity pattern
+  sp.compress();
+
+  SparsityPattern::const_iterator i = sp.begin();
+  for (; i != sp.end(); ++i)
+    deallog << i->row() << ' ' << i->column() << std::endl;
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int
+main()
+{
+  initlog();
+
+  try
+    {
+      test();
+    }
+  catch (std::exception &exc)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Exception on processing: " << std::endl
+              << exc.what() << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+
+      return 1;
+    }
+  catch (...)
+    {
+      deallog << std::endl
+              << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      deallog << "Unknown exception!" << std::endl
+              << "Aborting!" << std::endl
+              << "----------------------------------------------------"
+              << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/sparsity/sparsity_pattern_iterator_08.output b/tests/sparsity/sparsity_pattern_iterator_08.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.