blob: 405461e88ae9b04685eedaa1ad68548ad97d5d8d [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
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
22template <class D>
23void test()
24{
Howard Hinnantc0331152012-07-13 19:17:27 +000025 {
Howard Hinnant3e519522010-05-11 19:42:16 +000026 typedef typename D::rep Rep;
27 Rep max_rep = std::chrono::duration_values<Rep>::max();
28 assert(D::max().count() == max_rep);
Howard Hinnantc0331152012-07-13 19:17:27 +000029 }
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
Howard Hinnant3e519522010-05-11 19:42:16 +000037}
38
39int main()
40{
41 test<std::chrono::duration<int> >();
42 test<std::chrono::duration<Rep> >();
43}