]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test. 5809/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sat, 27 Jan 2018 01:17:32 +0000 (18:17 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 27 Jan 2018 19:28:13 +0000 (12:28 -0700)
tests/base/is_contiguous_pointers.cc [new file with mode: 0644]
tests/base/is_contiguous_pointers.output [new file with mode: 0644]

diff --git a/tests/base/is_contiguous_pointers.cc b/tests/base/is_contiguous_pointers.cc
new file mode 100644 (file)
index 0000000..b5e4af1
--- /dev/null
@@ -0,0 +1,45 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 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 is_contiguous works correctly for pointers
+
+#include "../tests.h"
+
+#include <deal.II/base/array_view.h>
+
+void test ()
+{
+  constexpr int *p = nullptr;
+  constexpr int *q = nullptr;
+
+  // the following code would fail if we tried to call the
+  // non-constexpr version of the function, so this really must be the
+  // pointer overload which we know always returns true
+  constexpr bool b = internal::ArrayViewHelper::is_contiguous (p, q);
+
+  Assert (b == true, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+int main()
+{
+  deal_II_exceptions::disable_abort_on_exception();
+  initlog();
+
+  test();
+}
diff --git a/tests/base/is_contiguous_pointers.output b/tests/base/is_contiguous_pointers.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.