| 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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
| 10 | // UNSUPPORTED: no-filesystem, no-localization, no-tzdb |
| 11 | |
| 12 | // XFAIL: libcpp-has-no-experimental-tzdb |
| 13 | // XFAIL: availability-tzdb-missing |
| 14 | |
| 15 | // <chrono> |
| 16 | // |
| 17 | // class tzdb_list; |
| 18 | // |
| 19 | // const_iterator begin() const noexcept; |
| 20 | // const_iterator end() const noexcept; |
| 21 | // |
| 22 | // const_iterator cbegin() const noexcept; |
| 23 | // const_iterator cend() const noexcept; |
| 24 | |
| 25 | #include <chrono> |
| 26 | #include <iterator> |
| 27 | #include <cassert> |
| 28 | |
| 29 | int main(int, char**) { |
| 30 | const std::chrono::tzdb_list& list = std::chrono::get_tzdb_list(); |
| 31 | using it = std::chrono::tzdb_list::const_iterator; |
| 32 | |
| 33 | static_assert(noexcept(list.begin())); |
| 34 | static_assert(noexcept(list.end())); |
| 35 | static_assert(noexcept(list.cbegin())); |
| 36 | static_assert(noexcept(list.cend())); |
| 37 | |
| 38 | std::same_as<it> auto begin = list.begin(); |
| 39 | std::same_as<it> auto end = list.end(); |
| 40 | assert(std::distance(begin, end) == 1); |
| 41 | |
| 42 | std::same_as<it> auto cbegin = list.cbegin(); |
| 43 | assert(begin == cbegin); |
| 44 | |
| 45 | std::same_as<it> auto cend = list.cend(); |
| 46 | assert(end == cend); |
| 47 | |
| 48 | return 0; |
| 49 | } |
| 50 | |