[clang][test][OpenMP] Fix test assumptions of libomp and clang paths (#125891)
[llvm-project.git] / libcxx / test / std / containers / views / mdspan / layout_left / properties.pass.cpp
blob32442ecd5a0e6de786ba14b363246cfd5661f2c0
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 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
11 // <mdspan>
13 // namespace std {
14 // template<class Extents>
15 // class layout_left::mapping {
17 // ...
18 // static constexpr bool is_always_unique() noexcept { return true; }
19 // static constexpr bool is_always_exhaustive() noexcept { return true; }
20 // static constexpr bool is_always_strided() noexcept { return true; }
22 // static constexpr bool is_unique() noexcept { return true; }
23 // static constexpr bool is_exhaustive() noexcept { return true; }
24 // static constexpr bool is_strided() noexcept { return true; }
25 // ...
26 // };
27 // }
29 #include <cassert>
30 #include <cstddef>
31 #include <mdspan>
32 #include <span> // dynamic_extent
33 #include <utility>
35 #include "test_macros.h"
37 template <class E>
38 constexpr void test_layout_mapping_left() {
39 using M = std::layout_left::mapping<E>;
40 assert(M::is_unique() == true);
41 assert(M::is_exhaustive() == true);
42 assert(M::is_strided() == true);
43 assert(M::is_always_unique() == true);
44 assert(M::is_always_exhaustive() == true);
45 assert(M::is_always_strided() == true);
46 ASSERT_NOEXCEPT(std::declval<M>().is_unique());
47 ASSERT_NOEXCEPT(std::declval<M>().is_exhaustive());
48 ASSERT_NOEXCEPT(std::declval<M>().is_strided());
49 ASSERT_NOEXCEPT(M::is_always_unique());
50 ASSERT_NOEXCEPT(M::is_always_exhaustive());
51 ASSERT_NOEXCEPT(M::is_always_strided());
54 constexpr bool test() {
55 constexpr size_t D = std::dynamic_extent;
56 test_layout_mapping_left<std::extents<int>>();
57 test_layout_mapping_left<std::extents<signed char, 4, 5>>();
58 test_layout_mapping_left<std::extents<unsigned, D, 4>>();
59 test_layout_mapping_left<std::extents<size_t, D, D, D, D>>();
60 return true;
63 int main(int, char**) {
64 test();
65 static_assert(test());
66 return 0;