From: Wolfgang Bangerth Date: Thu, 12 Oct 2023 21:41:59 +0000 (-0600) Subject: Add a test. X-Git-Tag: relicensing~400^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=943e4c93cf93b3e47bad5a142e2527d5a100b9e8;p=dealii.git Add a test. --- diff --git a/tests/base/array_view_22.cc b/tests/base/array_view_22.cc new file mode 100644 index 0000000000..53b371cd5c --- /dev/null +++ b/tests/base/array_view_22.cc @@ -0,0 +1,62 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2017 - 2018 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 for class ArrayView with boost::container::small_vector + +#include + +#include "../tests.h" + + +void +test() +{ + { + boost::container::small_vector arr = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + ArrayView view(arr); // writable view + for (auto &el : view) + ++el; + + int i = 0; + for (auto &&it = arr.cbegin(); it != arr.cend(); ++it, ++i) + AssertThrow(*it == i + 1, ExcInternalError()); + } + + { + boost::container::small_vector arr = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + const ArrayView view(arr); // writable view + for (auto &el : view) + ++el; + + int i = 0; + for (auto &&it = arr.cbegin(); it != arr.cend(); ++it, ++i) + AssertThrow(*it == i + 1, ExcInternalError()); + } + + deallog << "OK" << std::endl; +} + + + +int +main() +{ + initlog(); + + test(); +} diff --git a/tests/base/array_view_22.output b/tests/base/array_view_22.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/array_view_22.output @@ -0,0 +1,2 @@ + +DEAL::OK