]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 3 Oct 2017 01:02:34 +0000 (19:02 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 4 Oct 2017 15:29:09 +0000 (09:29 -0600)
tests/base/table_07.cc [new file with mode: 0644]
tests/base/table_07.output [new file with mode: 0644]

diff --git a/tests/base/table_07.cc b/tests/base/table_07.cc
new file mode 100644 (file)
index 0000000..8ee7371
--- /dev/null
@@ -0,0 +1,55 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 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 at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// check that Table<N,T> works for types that can not be copy constructed
+
+#include "../tests.h"
+
+#include <deal.II/base/table.h>
+
+
+class T
+{
+public:
+  T ()
+  {
+    deallog << "Default construct." << std::endl;
+  }
+  T (const T &) = delete;
+  T (T &&)
+  {
+    deallog << "Move construct." << std::endl;
+  }
+
+  T &operator= (const T &) = delete;
+  T &operator= (T &&)
+  {
+    deallog << "Move assign." << std::endl;
+    return *this;
+  }
+};
+
+
+int main()
+{
+  initlog();
+  dealii::Table<2,T> table(2,2);
+
+  dealii::Table<2,T> table2;
+  table2 = std::move(table); // should not create new objects
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/base/table_07.output b/tests/base/table_07.output
new file mode 100644 (file)
index 0000000..9ef77df
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Default construct.
+DEAL::Default construct.
+DEAL::Default construct.
+DEAL::Default construct.
+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.