]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test.
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 22 Jul 2017 20:29:46 +0000 (14:29 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 22 Jul 2017 20:31:32 +0000 (14:31 -0600)
tests/lac/constraint_matrix_copy_01.cc [new file with mode: 0644]
tests/lac/constraint_matrix_copy_01.output [new file with mode: 0644]

diff --git a/tests/lac/constraint_matrix_copy_01.cc b/tests/lac/constraint_matrix_copy_01.cc
new file mode 100644 (file)
index 0000000..f260a4a
--- /dev/null
@@ -0,0 +1,65 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2005 - 2015 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+#include  <deal.II/lac/constraint_matrix.h>
+
+#include <fstream>
+#include <vector>
+
+void test()
+{
+  ConstraintMatrix constraints;
+
+  constraints.add_line(1);
+  constraints.add_entry(1,2,1.);
+  constraints.add_entry(1,3,1.);
+
+  constraints.add_line(3);
+  constraints.add_entry(3,4,1.);
+  constraints.add_entry(3,5,1.);
+
+  constraints.add_line(5);
+  constraints.add_entry(5,0,1.);
+
+  constraints.close();
+
+  // copy the object above
+  ConstraintMatrix constraints_2;
+  constraints_2.copy_from (constraints);
+
+  // let both objects describe themselves in string form
+  std::ostringstream s1, s2;
+  constraints.print (s1);
+  constraints_2.print (s2);
+
+  // make sure they're the same
+  Assert (s1.str() == s2.str(),
+          ExcInternalError());
+}
+
+int main()
+{
+  std::ofstream logfile("output");
+  logfile.precision(2);
+
+  deallog.attach(logfile);
+  deallog.threshold_double(1.e-10);
+
+  test();
+
+  deallog<<"OK"<<std::endl;
+}
diff --git a/tests/lac/constraint_matrix_copy_01.output b/tests/lac/constraint_matrix_copy_01.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.