From 86cf190987b9ed987f6875895fc28e50ec0e7baa Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Tue, 15 Aug 2017 08:34:05 -0600 Subject: [PATCH] Add comprehensive test for symmetric tensor constructor and initializer --- tests/base/symmetric_tensor_42.cc | 68 +++++++++++++++++++++++++++ tests/base/symmetric_tensor_42.output | 14 ++++++ 2 files changed, 82 insertions(+) create mode 100644 tests/base/symmetric_tensor_42.cc create mode 100644 tests/base/symmetric_tensor_42.output diff --git a/tests/base/symmetric_tensor_42.cc b/tests/base/symmetric_tensor_42.cc new file mode 100644 index 0000000000..9e95cd83e2 --- /dev/null +++ b/tests/base/symmetric_tensor_42.cc @@ -0,0 +1,68 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// Verify that symmetric tensor construction and initialization +// works as expected for non-trivial number types + +#include "../tests.h" +#include + +#include + +template +void test_constructor () +{ + const SymmetricTensor t1; +} + +template +void test_initializer () +{ + const SymmetricTensor t1; + const SymmetricTensor t2 (t1); +} + +template +void test () +{ + deallog << "constructor" << std::endl; + test_constructor<1,rank,NumberType> (); + test_constructor<2,rank,NumberType> (); + test_constructor<3,rank,NumberType> (); + + deallog << "initializer" << std::endl; + test_initializer<1,rank,NumberType,OtherNumberType> (); + test_initializer<2,rank,NumberType,OtherNumberType> (); + test_initializer<3,rank,NumberType,OtherNumberType> (); +} + + +int main () +{ + initlog(); + + deallog << "rank 2, double" << std::endl; + test<2, double, float >(); + deallog << "rank 2, std::complex" << std::endl; + test<2, std::complex, std::complex >(); + + deallog << "rank 4, double" << std::endl; + test<4, double, float >(); + deallog << "rank 4, std::complex" << std::endl; + test<4, std::complex, std::complex >(); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/symmetric_tensor_42.output b/tests/base/symmetric_tensor_42.output new file mode 100644 index 0000000000..19ec964270 --- /dev/null +++ b/tests/base/symmetric_tensor_42.output @@ -0,0 +1,14 @@ + +DEAL::rank 2, double +DEAL::constructor +DEAL::initializer +DEAL::rank 2, std::complex +DEAL::constructor +DEAL::initializer +DEAL::rank 4, double +DEAL::constructor +DEAL::initializer +DEAL::rank 4, std::complex +DEAL::constructor +DEAL::initializer +DEAL::OK -- 2.39.5