]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do compile { target c++14 } } |
1c9f675f | 2 | |
a945c346 | 3 | // Copyright (C) 2013-2024 Free Software Foundation, Inc. |
1c9f675f ESR |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 3, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING3. If not see | |
18 | // <http://www.gnu.org/licenses/>. | |
19 | ||
1c9f675f ESR |
20 | #include <chrono> |
21 | #include <type_traits> | |
22 | ||
23 | void | |
24 | test03() | |
25 | { | |
26 | using namespace std::literals::chrono_literals; | |
27 | ||
28 | static_assert(std::is_same<decltype(1h), std::chrono::hours>::value, | |
29 | "1h is std::chrono::hours"); | |
30 | ||
31 | static_assert(std::is_same<decltype(1.0h), | |
32 | std::chrono::duration<long double, std::ratio<3600L, 1L>>>::value, | |
33 | "1.0h is std::chrono::duration<long double, std::ratio<3600L, 1L>>"); | |
34 | ||
35 | static_assert(std::is_same<decltype(1min), std::chrono::minutes>::value, | |
36 | "1min is std::chrono::minutes"); | |
37 | ||
38 | static_assert(std::is_same<decltype(1.0min), | |
39 | std::chrono::duration<long double, std::ratio<60L, 1L>>>::value, | |
40 | "1.0min is std::chrono::duration<long double, std::ratio<60L, 1L>>"); | |
41 | ||
42 | static_assert(std::is_same<decltype(1s), std::chrono::seconds>::value, | |
43 | "1s is std::chrono::seconds"); | |
44 | ||
45 | static_assert(std::is_same<decltype(1.0s), | |
46 | std::chrono::duration<long double, std::ratio<1L, 1L>>>::value, | |
47 | "1.0s is std::chrono::duration<long double, std::ratio<1L, 1L>>"); | |
48 | ||
49 | static_assert(std::is_same<decltype(1ms), std::chrono::milliseconds>::value, | |
50 | "1ms is std::chrono::milliseconds"); | |
51 | ||
52 | static_assert(std::is_same<decltype(1.0ms), | |
53 | std::chrono::duration<long double, std::ratio<1L, 1000L>>>::value, | |
54 | "1.0ms is std::chrono::duration<long double, std::ratio<1L, 1000L>>"); | |
55 | ||
56 | static_assert(std::is_same<decltype(1us), std::chrono::microseconds>::value, | |
57 | "1us is std::chrono::microseconds"); | |
58 | ||
59 | static_assert(std::is_same<decltype(1.0us), | |
60 | std::chrono::duration<long double, std::ratio<1L, 1000000L>>>::value, | |
61 | "1.0us is std::chrono::duration<long double, std::ratio<1L, 1000000L>>"); | |
62 | ||
63 | static_assert(std::is_same<decltype(1ns), std::chrono::nanoseconds>::value, | |
64 | "1ns is std::chrono::nanoseconds"); | |
65 | ||
66 | static_assert(std::is_same<decltype(1.0ns), | |
67 | std::chrono::duration<long double, std::ratio<1L, 1000000000L>>>::value, | |
68 | "1.0ns is std::chrono::duration<long double, std::ratio<1L, 1000000000L>>"); | |
69 | } |