From: Daniel Garcia-Sanchez Date: Wed, 24 Jul 2019 18:55:00 +0000 (+0200) Subject: Add test for Point assignment operator X-Git-Tag: v9.2.0-rc1~1358^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a699298b4ace85639d6459f1fd784e3d1517fe61;p=dealii.git Add test for Point assignment operator --- diff --git a/tests/base/point_05.cc b/tests/base/point_05.cc new file mode 100644 index 0000000000..f25d9e0673 --- /dev/null +++ b/tests/base/point_05.cc @@ -0,0 +1,95 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2019 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 for Point::operator= with different number types + +#include + +#include + +#include "../tests.h" + + +template +void +check() +{ + { + Point p_float; + Point p_double; + Point> p_complex_float; + Point> p_complex_double; + + for (unsigned int i = 0; i < dim; ++i) + p_float[i] = i; + + p_double = p_float; + p_complex_float = p_float; + p_complex_double = p_float; + + + for (unsigned int i = 0; i < dim; ++i) + deallog << p_float(i) << ' '; + deallog << std::endl; + + for (unsigned int i = 0; i < dim; ++i) + deallog << p_double(i) << ' '; + deallog << std::endl; + + for (unsigned int i = 0; i < dim; ++i) + deallog << p_complex_float(i) << ' '; + deallog << std::endl; + + for (unsigned int i = 0; i < dim; ++i) + deallog << p_complex_double(i) << ' '; + deallog << std::endl; + } + + { + Point p_double; + Point> p_complex_float; + Point> p_complex_double; + + for (unsigned int i = 0; i < dim; ++i) + p_double[i] = i + 0.1; + + p_complex_float = p_double; + p_complex_double = p_double; + + for (unsigned int i = 0; i < dim; ++i) + deallog << p_double(i) << ' '; + deallog << std::endl; + + for (unsigned int i = 0; i < dim; ++i) + deallog << p_complex_float(i) << ' '; + deallog << std::endl; + + for (unsigned int i = 0; i < dim; ++i) + deallog << p_complex_double(i) << ' '; + deallog << std::endl; + } +} + +int +main() +{ + initlog(); + deallog << std::setprecision(3); + + check<1>(); + check<2>(); + check<3>(); +} diff --git a/tests/base/point_05.output b/tests/base/point_05.output new file mode 100644 index 0000000000..3002cde066 --- /dev/null +++ b/tests/base/point_05.output @@ -0,0 +1,22 @@ + +DEAL::0.00 +DEAL::0.00 +DEAL::(0.00,0.00) +DEAL::(0.00,0.00) +DEAL::0.100 +DEAL::(0.100,0.00) +DEAL::(0.100,0.00) +DEAL::0.00 1.00 +DEAL::0.00 1.00 +DEAL::(0.00,0.00) (1.00,0.00) +DEAL::(0.00,0.00) (1.00,0.00) +DEAL::0.100 1.10 +DEAL::(0.100,0.00) (1.10,0.00) +DEAL::(0.100,0.00) (1.10,0.00) +DEAL::0.00 1.00 2.00 +DEAL::0.00 1.00 2.00 +DEAL::(0.00,0.00) (1.00,0.00) (2.00,0.00) +DEAL::(0.00,0.00) (1.00,0.00) (2.00,0.00) +DEAL::0.100 1.10 2.10 +DEAL::(0.100,0.00) (1.10,0.00) (2.10,0.00) +DEAL::(0.100,0.00) (1.10,0.00) (2.10,0.00)