xref: /llvm-project/libcxx/test/std/time/time.zone/time.zone.db/time.zone.db.access/get_tzdb.pass.cpp (revision a4422a51941bfcffc870d1e2fff682e5387f89c2)
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 // const tzdb& get_tzdb();
18 
19 #include <algorithm>
20 #include <cassert>
21 #include <chrono>
22 
23 #include "test_macros.h"
24 
main(int,const char **)25 int main(int, const char**) {
26   const std::chrono::tzdb& db = std::chrono::get_tzdb();
27 
28   assert(!db.version.empty());
29 
30   assert(!db.zones.empty());
31   assert(std::ranges::is_sorted(db.zones));
32   assert(std::ranges::adjacent_find(db.zones) == db.zones.end()); // is unique?
33 
34   assert(!db.links.empty());
35   assert(std::ranges::is_sorted(db.links));
36   assert(std::ranges::adjacent_find(db.links) == db.links.end()); // is unique?
37 
38   assert(!db.leap_seconds.empty());
39   assert(std::ranges::is_sorted(db.leap_seconds));
40 
41   return 0;
42 }
43