]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Two test cases 9775/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 30 Mar 2020 06:21:46 +0000 (08:21 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 30 Mar 2020 06:21:46 +0000 (08:21 +0200)
tests/base/utilities_21.cc [new file with mode: 0644]
tests/base/utilities_21.output [new file with mode: 0644]
tests/base/utilities_22.cc [new file with mode: 0644]
tests/base/utilities_22.expect=build.output [new file with mode: 0644]

diff --git a/tests/base/utilities_21.cc b/tests/base/utilities_21.cc
new file mode 100644 (file)
index 0000000..dba99a2
--- /dev/null
@@ -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 <deal.II/base/utilities.h>
+
+#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 (file)
index 0000000..5422bfb
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::2144533077
diff --git a/tests/base/utilities_22.cc b/tests/base/utilities_22.cc
new file mode 100644 (file)
index 0000000..e7142e6
--- /dev/null
@@ -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 <deal.II/base/utilities.h>
+
+#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 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.