1 // { dg-options "-std=gnu++1y" }
4 // Copyright (C) 2013 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
22 #include <type_traits>
27 using namespace std::literals::chrono_literals
;
29 static_assert(std::is_same
<decltype(1h
), std::chrono::hours
>::value
,
30 "1h is std::chrono::hours");
32 static_assert(std::is_same
<decltype(1.0h
),
33 std::chrono::duration
<long double, std::ratio
<3600L, 1L>>>::value
,
34 "1.0h is std::chrono::duration<long double, std::ratio<3600L, 1L>>");
36 static_assert(std::is_same
<decltype(1min
), std::chrono::minutes
>::value
,
37 "1min is std::chrono::minutes");
39 static_assert(std::is_same
<decltype(1.0min
),
40 std::chrono::duration
<long double, std::ratio
<60L, 1L>>>::value
,
41 "1.0min is std::chrono::duration<long double, std::ratio<60L, 1L>>");
43 static_assert(std::is_same
<decltype(1s
), std::chrono::seconds
>::value
,
44 "1s is std::chrono::seconds");
46 static_assert(std::is_same
<decltype(1.0s
),
47 std::chrono::duration
<long double, std::ratio
<1L, 1L>>>::value
,
48 "1.0s is std::chrono::duration<long double, std::ratio<1L, 1L>>");
50 static_assert(std::is_same
<decltype(1ms
), std::chrono::milliseconds
>::value
,
51 "1ms is std::chrono::milliseconds");
53 static_assert(std::is_same
<decltype(1.0ms
),
54 std::chrono::duration
<long double, std::ratio
<1L, 1000L>>>::value
,
55 "1.0ms is std::chrono::duration<long double, std::ratio<1L, 1000L>>");
57 static_assert(std::is_same
<decltype(1us
), std::chrono::microseconds
>::value
,
58 "1us is std::chrono::microseconds");
60 static_assert(std::is_same
<decltype(1.0us
),
61 std::chrono::duration
<long double, std::ratio
<1L, 1000000L>>>::value
,
62 "1.0us is std::chrono::duration<long double, std::ratio<1L, 1000000L>>");
64 static_assert(std::is_same
<decltype(1ns
), std::chrono::nanoseconds
>::value
,
65 "1ns is std::chrono::nanoseconds");
67 static_assert(std::is_same
<decltype(1.0ns
),
68 std::chrono::duration
<long double, std::ratio
<1L, 1000000000L>>>::value
,
69 "1.0ns is std::chrono::duration<long double, std::ratio<1L, 1000000000L>>");