From 1f4fca04a71262bf760c3e5f2317ab5881d3f6fe Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Mon, 30 Mar 2020 08:21:46 +0200 Subject: [PATCH] Two test cases --- tests/base/utilities_21.cc | 45 +++++++++++++++++++++ tests/base/utilities_21.output | 2 + tests/base/utilities_22.cc | 33 +++++++++++++++ tests/base/utilities_22.expect=build.output | 2 + 4 files changed, 82 insertions(+) create mode 100644 tests/base/utilities_21.cc create mode 100644 tests/base/utilities_21.output create mode 100644 tests/base/utilities_22.cc create mode 100644 tests/base/utilities_22.expect=build.output diff --git a/tests/base/utilities_21.cc b/tests/base/utilities_21.cc new file mode 100644 index 0000000000..dba99a2de5 --- /dev/null +++ b/tests/base/utilities_21.cc @@ -0,0 +1,45 @@ +// --------------------------------------------------------------------- +// +// 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 Utilities::pow + +#include + +#include "../tests.h" + + + +int +main() +{ + initlog(); + + constexpr int a = Utilities::pow(100, 2); + constexpr int b = Utilities::pow(200, 2); + constexpr int c = Utilities::pow(215, 2); + constexpr int d = Utilities::pow(216, 2); + constexpr int e = Utilities::pow(500, 2); + constexpr int f = Utilities::pow(600, 2); + constexpr int g = Utilities::pow(700, 2); + constexpr int h = Utilities::pow(800, 2); + constexpr int i = Utilities::pow(900, 2); + constexpr int j = Utilities::pow(215, 3); + constexpr int k = Utilities::pow(216, 3); + constexpr int l = Utilities::pow(1285, 3); + deallog << a + b + c + d + e + f + g + h + i + j + k + l << std::endl; + + return 0; +} diff --git a/tests/base/utilities_21.output b/tests/base/utilities_21.output new file mode 100644 index 0000000000..5422bfb136 --- /dev/null +++ b/tests/base/utilities_21.output @@ -0,0 +1,2 @@ + +DEAL::2144533077 diff --git a/tests/base/utilities_22.cc b/tests/base/utilities_22.cc new file mode 100644 index 0000000000..e7142e66c6 --- /dev/null +++ b/tests/base/utilities_22.cc @@ -0,0 +1,33 @@ +// --------------------------------------------------------------------- +// +// 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 Utilities::pow where we should get an integer overflow and thus a +// compile error + +#include + +#include "../tests.h" + + + +int +main() +{ + initlog(); + + constexpr int a = Utilities::pow(216, 4); + deallog << a << std::endl; +} diff --git a/tests/base/utilities_22.expect=build.output b/tests/base/utilities_22.expect=build.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/utilities_22.expect=build.output @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5