From d1cc732abf18e78c593a7f99389ee15667bd434a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 11 Feb 2015 17:02:09 -0600 Subject: [PATCH] Add testcases. --- tests/base/product_type_02.cc | 69 +++++++++++++++++++++++++++++++ tests/base/product_type_02.output | 2 + tests/base/product_type_03.cc | 69 +++++++++++++++++++++++++++++++ tests/base/product_type_03.output | 2 + 4 files changed, 142 insertions(+) create mode 100644 tests/base/product_type_02.cc create mode 100644 tests/base/product_type_02.output create mode 100644 tests/base/product_type_03.cc create mode 100644 tests/base/product_type_03.output diff --git a/tests/base/product_type_02.cc b/tests/base/product_type_02.cc new file mode 100644 index 0000000000..c75d9a7ea4 --- /dev/null +++ b/tests/base/product_type_02.cc @@ -0,0 +1,69 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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. +// +// --------------------------------------------------------------------- + + +// test that the product between a tensor of rank 1 and a scalar +// results a result type as expected + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include +#include + + +template +void check() +{ + Assert (typeid(T() * U()) == typeid(CompareType), + ExcInternalError()); + Assert (typeid(T() * U()) == typeid(CompareType), + ExcInternalError()); +} + + +int main() +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + // check product of scalars + check,double,Tensor<1,1,double> >(); + check,Tensor<1,1,double> >(); + + check,float,Tensor<1,1,double> >(); + check,Tensor<1,1,double> >(); + + check,std::complex,Tensor<1,1,std::complex > >(); + check,Tensor<1,1,double>,Tensor<1,1,std::complex > >(); + + check,std::complex,Tensor<1,1,std::complex > >(); + check,Tensor<1,1,double>,Tensor<1,1,std::complex > >(); + + check,std::complex,Tensor<1,1,std::complex > >(); + check,Tensor<1,1,float>,Tensor<1,1,std::complex > >(); + + check,std::complex,Tensor<1,1,std::complex > >(); + check,Tensor<1,1,float>,Tensor<1,1,std::complex > >(); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/product_type_02.output b/tests/base/product_type_02.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/product_type_02.output @@ -0,0 +1,2 @@ + +DEAL::OK diff --git a/tests/base/product_type_03.cc b/tests/base/product_type_03.cc new file mode 100644 index 0000000000..7de4b4bd84 --- /dev/null +++ b/tests/base/product_type_03.cc @@ -0,0 +1,69 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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. +// +// --------------------------------------------------------------------- + + +// test that the product between a tensor of rank 2 and a scalar +// results a result type as expected + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +#include +#include + + +template +void check() +{ + Assert (typeid(T() * U()) == typeid(CompareType), + ExcInternalError()); + Assert (typeid(T() * U()) == typeid(CompareType), + ExcInternalError()); +} + + +int main() +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + // check product of scalars + check,double,Tensor<2,1,double> >(); + check,Tensor<2,1,double> >(); + + check,float,Tensor<2,1,double> >(); + check,Tensor<2,1,double> >(); + + check,std::complex,Tensor<2,1,std::complex > >(); + check,Tensor<2,1,double>,Tensor<2,1,std::complex > >(); + + check,std::complex,Tensor<2,1,std::complex > >(); + check,Tensor<2,1,double>,Tensor<2,1,std::complex > >(); + + check,std::complex,Tensor<2,1,std::complex > >(); + check,Tensor<2,1,float>,Tensor<2,1,std::complex > >(); + + check,std::complex,Tensor<2,1,std::complex > >(); + check,Tensor<2,1,float>,Tensor<2,1,std::complex > >(); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/product_type_03.output b/tests/base/product_type_03.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/product_type_03.output @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5