Home | History | Annotate | Download | only in time.duration.special
      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 min();
     15 
     16 #include <chrono>
     17 #include <limits>
     18 #include <cassert>
     19 
     20 #include "../../rep.h"
     21 
     22 template <class D>
     23 void test()
     24 {
     25     {
     26     typedef typename D::rep Rep;
     27     Rep min_rep = std::chrono::duration_values<Rep>::min();
     28     assert(D::min().count() == min_rep);
     29     }
     30 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
     31     {
     32     typedef typename D::rep Rep;
     33     constexpr Rep min_rep = std::chrono::duration_values<Rep>::min();
     34     static_assert(D::min().count() == min_rep, "");
     35     }
     36 #endif
     37 }
     38 
     39 int main()
     40 {
     41     test<std::chrono::duration<int> >();
     42     test<std::chrono::duration<Rep> >();
     43 }
     44