From: Wolfgang Bangerth Date: Sat, 27 Jan 2018 01:17:32 +0000 (-0700) Subject: Add test. X-Git-Tag: v9.0.0-rc1~507^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5809%2Fhead;p=dealii.git Add test. --- 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