| 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 | // UNSUPPORTED: c++03, c++11 |
| 9 | |
| 10 | #include <chrono> |
| 11 | #include <cassert> |
| 12 | |
| 13 | #include "test_macros.h" |
| 14 | |
| 15 | int main(int, char**) |
| 16 | { |
| 17 | using namespace std::chrono; |
| 18 | |
| 19 | hours h = 4h; |
| 20 | assert ( h == hours(4)); |
| 21 | auto h2 = 4.0h; |
| 22 | assert ( h == h2 ); |
| 23 | |
| 24 | minutes min = 36min; |
| 25 | assert ( min == minutes(36)); |
| 26 | auto min2 = 36.0min; |
| 27 | assert ( min == min2 ); |
| 28 | |
| 29 | seconds s = 24s; |
| 30 | assert ( s == seconds(24)); |
| 31 | auto s2 = 24.0s; |
| 32 | assert ( s == s2 ); |
| 33 | |
| 34 | milliseconds ms = 247ms; |
| 35 | assert ( ms == milliseconds(247)); |
| 36 | auto ms2 = 247.0ms; |
| 37 | assert ( ms == ms2 ); |
| 38 | |
| 39 | microseconds us = 867us; |
| 40 | assert ( us == microseconds(867)); |
| 41 | auto us2 = 867.0us; |
| 42 | assert ( us == us2 ); |
| 43 | |
| 44 | nanoseconds ns = 645ns; |
| 45 | assert ( ns == nanoseconds(645)); |
| 46 | auto ns2 = 645.ns; |
| 47 | assert ( ns == ns2 ); |
| 48 | |
| 49 | #if TEST_STD_VER > 17 |
| 50 | assert(Sunday == weekday(0)); |
| 51 | assert(Monday == weekday(1)); |
| 52 | assert(Tuesday == weekday(2)); |
| 53 | assert(Wednesday == weekday(3)); |
| 54 | assert(Thursday == weekday(4)); |
| 55 | assert(Friday == weekday(5)); |
| 56 | assert(Saturday == weekday(6)); |
| 57 | |
| 58 | assert(January == month(1)); |
| 59 | assert(February == month(2)); |
| 60 | assert(March == month(3)); |
| 61 | assert(April == month(4)); |
| 62 | assert(May == month(5)); |
| 63 | assert(June == month(6)); |
| 64 | assert(July == month(7)); |
| 65 | assert(August == month(8)); |
| 66 | assert(September == month(9)); |
| 67 | assert(October == month(10)); |
| 68 | assert(November == month(11)); |
| 69 | assert(December == month(12)); |
| 70 | #endif |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |