From 5025564fb1c79c85edad606fd1145b7789ad12ae Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 26 Jan 2018 18:17:32 -0700 Subject: [PATCH] Add test. --- tests/base/is_contiguous_pointers.cc | 45 ++++++++++++++++++++++++ tests/base/is_contiguous_pointers.output | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 tests/base/is_contiguous_pointers.cc create mode 100644 tests/base/is_contiguous_pointers.output diff --git a/tests/base/is_contiguous_pointers.cc b/tests/base/is_contiguous_pointers.cc new file mode 100644 index 0000000000..b5e4af13fc --- /dev/null +++ b/tests/base/is_contiguous_pointers.cc @@ -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 + +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 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/is_contiguous_pointers.output @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5