Debian Codegraph @

libstdc++-v3/testsuite/std/time/zoned_traits.cc

raw
1 // { dg-do run { target c++20 } }
2 // { dg-require-effective-target cxx11_abi }
3
4 #include <chrono>
5 #include <testsuite_hooks.h>
6
7 using namespace std::chrono;
8
9 static_assert( std::is_empty_v<zoned_traits<const time_zone*>> );
10 static_assert(std::is_default_constructible_v<zoned_traits<const time_zone*>>);
11
12 // The primary template is a complete type, it just has no members.
13 static_assert( std::is_empty_v<zoned_traits<time_zone*>> );
14 static_assert(std::is_default_constructible_v<zoned_traits<time_zone*>>);
15 static_assert( std::is_empty_v<zoned_traits<int>> );
16 static_assert(std::is_default_constructible_v<zoned_traits<int>>);
17
18 void
19 test_default_zone()
20 {
21 auto p = zoned_traits<const time_zone*>::default_zone();
22 static_assert( std::is_same_v<decltype(p), const time_zone*> );
23 VERIFY( p == locate_zone("UTC") );
24 }
25
26 void
27 test_locate_zone()
28 {
29 auto p = zoned_traits<const time_zone*>::locate_zone("GMT");
30 static_assert( std::is_same_v<decltype(p), const time_zone*> );
31 VERIFY( p == locate_zone("GMT") );
32 }
33
34 int main()
35 {
36 test_default_zone();
37 test_locate_zone();
38 }