From 8cde61de6ab06b13c369cbef29d9a8980296a977 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Wed, 9 Apr 2014 09:21:14 +0000 Subject: [PATCH] Rename tests for AlignedVector as aligned_vector_xx, add a test for a bool vector git-svn-id: https://svn.dealii.org/trunk@32746 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/aligned_vector_01.cc | 101 +++++++++ tests/base/aligned_vector_01.output | 8 + ...ctorization_03.cc => aligned_vector_02.cc} | 0 ...ion_03.output => aligned_vector_02.output} | 0 tests/base/aligned_vector_03.cc | 103 ++++++++++ tests/base/aligned_vector_03.output | 8 + tests/base/vectorization_01.cc | 194 ++++++++++++------ tests/base/vectorization_01.output | 61 +++++- tests/base/vectorization_04.cc | 171 --------------- tests/base/vectorization_04.output | 55 ----- 10 files changed, 406 insertions(+), 295 deletions(-) create mode 100644 tests/base/aligned_vector_01.cc create mode 100644 tests/base/aligned_vector_01.output rename tests/base/{vectorization_03.cc => aligned_vector_02.cc} (100%) rename tests/base/{vectorization_03.output => aligned_vector_02.output} (100%) create mode 100644 tests/base/aligned_vector_03.cc create mode 100644 tests/base/aligned_vector_03.output delete mode 100644 tests/base/vectorization_04.cc delete mode 100644 tests/base/vectorization_04.output diff --git a/tests/base/aligned_vector_01.cc b/tests/base/aligned_vector_01.cc new file mode 100644 index 0000000000..b2a1026415 --- /dev/null +++ b/tests/base/aligned_vector_01.cc @@ -0,0 +1,101 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2012 - 2013 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 for AlignedVector which tests the basic stuff in the +// aligned vector + +#include "../tests.h" +#include +#include +#include + +#include + + +void test () +{ + typedef AlignedVector VEC; + VEC a(4); + deallog << "Constructor: "; + for (unsigned int i=0; i + +#include "../tests.h" +#include +#include +#include + +#include + + +void test () +{ + typedef AlignedVector VEC; + VEC a(4); + deallog << "Constructor: "; + for (unsigned int i=0; i which tests the basic stuff in the -// aligned vector +// test for arithmetic operations on VectorizedArray #include "../tests.h" #include -#include -#include +#include -#include +#include +template void test () { - typedef AlignedVector VEC; - VEC a(4); - deallog << "Constructor: "; - for (unsigned int i=0; i a, b, c; + const unsigned int n_vectors = VectorizedArray::n_array_elements; + a = Number(2.); + b = Number(-1.); + for (unsigned int i=0; i d = a + b; + for (unsigned int i=0; i e = d - b; + for (unsigned int i=0; i::epsilon(), + ExcInternalError()); + + deallog << "OK" << std::endl + << "Absolute value: "; + d = -c; + d = std::abs(d); + for (unsigned int i=0; i::epsilon(), + ExcInternalError()); + deallog << "OK" << std::endl + << "Cosine: "; + e = std::cos(c); + for (unsigned int i=0; i::epsilon(), + ExcInternalError()); + deallog << "OK" << std::endl + << "Tangent: "; + d = std::tan(e); + for (unsigned int i=0; i::epsilon(), + ExcInternalError()); + deallog << "OK" << std::endl + << "Exponential: "; + d = std::exp(c-a); + for (unsigned int i=0; i::epsilon(), + ExcInternalError()); + deallog << "OK" << std::endl + << "Logarithm: "; + e = std::log(d); + for (unsigned int i=0; i::epsilon(), + ExcInternalError()); deallog << "OK" << std::endl; } @@ -97,5 +155,17 @@ int main() deallog.depth_console(0); deallog.threshold_double(1.e-10); - test (); + deallog.push("double"); + test (); + deallog.pop(); + deallog.push("float"); + test (); + deallog.pop(); + + // test long double: in that case, the default + // path of VectorizedArray is taken no matter + // what was done for double or float + deallog.push("long double"); + test (); + deallog.pop(); } diff --git a/tests/base/vectorization_01.output b/tests/base/vectorization_01.output index 1b934a8299..c11369e533 100644 --- a/tests/base/vectorization_01.output +++ b/tests/base/vectorization_01.output @@ -1,8 +1,55 @@ -DEAL::Constructor: 0 0 0 0 -DEAL::Insertion: 0 0 1 0 5 42 0 0 1 0 5 42 27 -DEAL::Shrinking: 0 0 1 0 -DEAL::Reserve: 0 0 1 0 -DEAL::Assignment: 0 0 1 0 5 42 27 -DEAL::Check large initialization: OK -DEAL::Check large resize: OK +DEAL:double::Addition: OK +DEAL:double::Subtraction: OK +DEAL:double::Multiplication: OK +DEAL:double::Division: OK +DEAL:double::Multiplication scalar: OK +DEAL:double::Division scalar left: OK +DEAL:double::Division scalar right: OK +DEAL:double::Unary operator -: OK +DEAL:double::Unary operator +: OK +DEAL:double::Square root: OK +DEAL:double::Absolute value: OK +DEAL:double::Maximum value: OK +DEAL:double::Minimum value: OK +DEAL:double::Sine: OK +DEAL:double::Cosine: OK +DEAL:double::Tangent: OK +DEAL:double::Exponential: OK +DEAL:double::Logarithm: OK +DEAL:float::Addition: OK +DEAL:float::Subtraction: OK +DEAL:float::Multiplication: OK +DEAL:float::Division: OK +DEAL:float::Multiplication scalar: OK +DEAL:float::Division scalar left: OK +DEAL:float::Division scalar right: OK +DEAL:float::Unary operator -: OK +DEAL:float::Unary operator +: OK +DEAL:float::Square root: OK +DEAL:float::Absolute value: OK +DEAL:float::Maximum value: OK +DEAL:float::Minimum value: OK +DEAL:float::Sine: OK +DEAL:float::Cosine: OK +DEAL:float::Tangent: OK +DEAL:float::Exponential: OK +DEAL:float::Logarithm: OK +DEAL:long double::Addition: OK +DEAL:long double::Subtraction: OK +DEAL:long double::Multiplication: OK +DEAL:long double::Division: OK +DEAL:long double::Multiplication scalar: OK +DEAL:long double::Division scalar left: OK +DEAL:long double::Division scalar right: OK +DEAL:long double::Unary operator -: OK +DEAL:long double::Unary operator +: OK +DEAL:long double::Square root: OK +DEAL:long double::Absolute value: OK +DEAL:long double::Maximum value: OK +DEAL:long double::Minimum value: OK +DEAL:long double::Sine: OK +DEAL:long double::Cosine: OK +DEAL:long double::Tangent: OK +DEAL:long double::Exponential: OK +DEAL:long double::Logarithm: OK diff --git a/tests/base/vectorization_04.cc b/tests/base/vectorization_04.cc deleted file mode 100644 index bb2e43046f..0000000000 --- a/tests/base/vectorization_04.cc +++ /dev/null @@ -1,171 +0,0 @@ -// --------------------------------------------------------------------- -// $Id$ -// -// Copyright (C) 2012 - 2013 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 for arithmetic operations on VectorizedArray - -#include "../tests.h" -#include -#include - -#include - - -template -void test () -{ - // since the number of array elements is system dependent, it is not a good - // idea to print them to an output file. Instead, check the values manually - VectorizedArray a, b, c; - const unsigned int n_vectors = VectorizedArray::n_array_elements; - a = Number(2.); - b = Number(-1.); - for (unsigned int i=0; i d = a + b; - for (unsigned int i=0; i e = d - b; - for (unsigned int i=0; i::epsilon(), - ExcInternalError()); - - deallog << "OK" << std::endl - << "Absolute value: "; - d = -c; - d = std::abs(d); - for (unsigned int i=0; i::epsilon(), - ExcInternalError()); - deallog << "OK" << std::endl - << "Cosine: "; - e = std::cos(c); - for (unsigned int i=0; i::epsilon(), - ExcInternalError()); - deallog << "OK" << std::endl - << "Tangent: "; - d = std::tan(e); - for (unsigned int i=0; i::epsilon(), - ExcInternalError()); - deallog << "OK" << std::endl - << "Exponential: "; - d = std::exp(c-a); - for (unsigned int i=0; i::epsilon(), - ExcInternalError()); - deallog << "OK" << std::endl - << "Logarithm: "; - e = std::log(d); - for (unsigned int i=0; i::epsilon(), - ExcInternalError()); - deallog << "OK" << std::endl; -} - - - - -int main() -{ - std::ofstream logfile("output"); - deallog.attach(logfile); - deallog.depth_console(0); - deallog.threshold_double(1.e-10); - - deallog.push("double"); - test (); - deallog.pop(); - deallog.push("float"); - test (); - deallog.pop(); - - // test long double: in that case, the default - // path of VectorizedArray is taken no matter - // what was done for double or float - deallog.push("long double"); - test (); - deallog.pop(); -} diff --git a/tests/base/vectorization_04.output b/tests/base/vectorization_04.output deleted file mode 100644 index c11369e533..0000000000 --- a/tests/base/vectorization_04.output +++ /dev/null @@ -1,55 +0,0 @@ - -DEAL:double::Addition: OK -DEAL:double::Subtraction: OK -DEAL:double::Multiplication: OK -DEAL:double::Division: OK -DEAL:double::Multiplication scalar: OK -DEAL:double::Division scalar left: OK -DEAL:double::Division scalar right: OK -DEAL:double::Unary operator -: OK -DEAL:double::Unary operator +: OK -DEAL:double::Square root: OK -DEAL:double::Absolute value: OK -DEAL:double::Maximum value: OK -DEAL:double::Minimum value: OK -DEAL:double::Sine: OK -DEAL:double::Cosine: OK -DEAL:double::Tangent: OK -DEAL:double::Exponential: OK -DEAL:double::Logarithm: OK -DEAL:float::Addition: OK -DEAL:float::Subtraction: OK -DEAL:float::Multiplication: OK -DEAL:float::Division: OK -DEAL:float::Multiplication scalar: OK -DEAL:float::Division scalar left: OK -DEAL:float::Division scalar right: OK -DEAL:float::Unary operator -: OK -DEAL:float::Unary operator +: OK -DEAL:float::Square root: OK -DEAL:float::Absolute value: OK -DEAL:float::Maximum value: OK -DEAL:float::Minimum value: OK -DEAL:float::Sine: OK -DEAL:float::Cosine: OK -DEAL:float::Tangent: OK -DEAL:float::Exponential: OK -DEAL:float::Logarithm: OK -DEAL:long double::Addition: OK -DEAL:long double::Subtraction: OK -DEAL:long double::Multiplication: OK -DEAL:long double::Division: OK -DEAL:long double::Multiplication scalar: OK -DEAL:long double::Division scalar left: OK -DEAL:long double::Division scalar right: OK -DEAL:long double::Unary operator -: OK -DEAL:long double::Unary operator +: OK -DEAL:long double::Square root: OK -DEAL:long double::Absolute value: OK -DEAL:long double::Maximum value: OK -DEAL:long double::Minimum value: OK -DEAL:long double::Sine: OK -DEAL:long double::Cosine: OK -DEAL:long double::Tangent: OK -DEAL:long double::Exponential: OK -DEAL:long double::Logarithm: OK -- 2.39.5