1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <chrono>
11 
12 // duration
13 
14 // static constexpr duration max();
15 
16 #include <chrono>
17 #include <limits>
18 #include <cassert>
19 
20 #include "../../rep.h"
21 
22 template <class D>
test()23 void test()
24 {
25     {
26     typedef typename D::rep Rep;
27     Rep max_rep = std::chrono::duration_values<Rep>::max();
28     assert(D::max().count() == max_rep);
29     }
30 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
31     {
32     typedef typename D::rep Rep;
33     constexpr Rep max_rep = std::chrono::duration_values<Rep>::max();
34     static_assert(D::max().count() == max_rep, "");
35     }
36 #endif
37 }
38 
main()39 int main()
40 {
41     test<std::chrono::duration<int> >();
42     test<std::chrono::duration<Rep> >();
43 }
44