1 // -*- C++ -*- 2 //===----------------------------------------------------------------------===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is dual licensed under the MIT and the University of Illinois Open 7 // Source Licenses. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 // UNSUPPORTED: c++98, c++03, c++11 11 12 #include <chrono> 13 #include <cassert> 14 main()15int main() 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