[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / sequences / array / contiguous.pass.cpp
blob85e6ed7ae9aeec5b2b8020791f6a4236fb514173
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <array>
11 // An array is a contiguous container
13 #include <array>
14 #include <cassert>
15 #include <memory>
17 #include "test_macros.h"
19 template <class Container>
20 TEST_CONSTEXPR_CXX14 void assert_contiguous(Container const& c)
22 for (std::size_t i = 0; i < c.size(); ++i)
23 assert(*(c.begin() + i) == *(std::addressof(*c.begin()) + i));
26 TEST_CONSTEXPR_CXX17 bool tests()
28 assert_contiguous(std::array<double, 0>());
29 assert_contiguous(std::array<double, 1>());
30 assert_contiguous(std::array<double, 2>());
31 assert_contiguous(std::array<double, 3>());
33 assert_contiguous(std::array<char, 0>());
34 assert_contiguous(std::array<char, 1>());
35 assert_contiguous(std::array<char, 2>());
36 assert_contiguous(std::array<char, 3>());
38 return true;
41 int main(int, char**)
43 tests();
44 #if TEST_STD_VER >= 17 // begin() & friends are constexpr in >= C++17 only
45 static_assert(tests(), "");
46 #endif
47 return 0;