From 081d66cc0d947c1d07abab90badbe9836fd26415 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 2 Oct 2017 19:02:34 -0600 Subject: [PATCH] Add a test. --- tests/base/table_07.cc | 55 ++++++++++++++++++++++++++++++++++++++ tests/base/table_07.output | 6 +++++ 2 files changed, 61 insertions(+) create mode 100644 tests/base/table_07.cc create mode 100644 tests/base/table_07.output diff --git a/tests/base/table_07.cc b/tests/base/table_07.cc new file mode 100644 index 0000000000..8ee737166a --- /dev/null +++ b/tests/base/table_07.cc @@ -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 works for types that can not be copy constructed + +#include "../tests.h" + +#include + + +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 index 0000000000..9ef77df91d --- /dev/null +++ b/tests/base/table_07.output @@ -0,0 +1,6 @@ + +DEAL::Default construct. +DEAL::Default construct. +DEAL::Default construct. +DEAL::Default construct. +DEAL::OK -- 2.39.5