1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 // Adaptation to Boost of the libcxx
10 // Copyright 2010 Vicente J. Botet Escriba
11 // Distributed under the Boost Software License, Version 1.0.
12 // See http://www.boost.org/LICENSE_1_0.txt
14 #include <boost/chrono/duration.hpp>
15 #include <boost/detail/lightweight_test.hpp>
18 #if defined BOOST_NO_CXX11_NUMERIC_LIMITS || defined BOOST_NO_CXX11_CONSTEXPR
19 #define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
21 #include <boost/static_assert.hpp>
22 #define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
28 typedef typename
D::rep Rep
;
29 Rep max_rep
= (boost::chrono::duration_values
<Rep
>::max
)();
30 BOOST_TEST((D::max
)().count() == max_rep
);
32 typedef typename
D::rep Rep
;
33 BOOST_CHRONO_LIB_CONSTEXPR Rep max_rep
= (boost::chrono::duration_values
<Rep
>::max
)();
34 BOOST_CONSTEXPR_ASSERT((D::max
)().count() == max_rep
);
41 typedef typename
D::rep Rep
;
42 Rep min_rep
= (boost::chrono::duration_values
<Rep
>::min
)();
43 BOOST_TEST((D::min
)().count() == min_rep
);
45 typedef typename
D::rep Rep
;
46 BOOST_CHRONO_LIB_CONSTEXPR Rep min_rep
= (boost::chrono::duration_values
<Rep
>::min
)();
47 BOOST_CONSTEXPR_ASSERT((D::min
)().count() == min_rep
);
55 typedef typename
D::rep Rep
;
56 Rep zero_rep
= boost::chrono::duration_values
<Rep
>::zero();
57 BOOST_TEST(D::zero().count() == zero_rep
);
59 typedef typename
D::rep Rep
;
60 BOOST_CONSTEXPR Rep zero_rep
= boost::chrono::duration_values
<Rep
>::zero();
61 BOOST_CONSTEXPR_ASSERT(D::zero().count() == zero_rep
);
69 check_max
<boost::chrono::duration
<int> >();
70 check_max
<boost::chrono::duration
<Rep
> >();
71 check_min
<boost::chrono::duration
<int> >();
72 check_min
<boost::chrono::duration
<Rep
> >();
73 check_zero
<boost::chrono::duration
<int> >();
74 check_zero
<boost::chrono::duration
<Rep
> >();
75 return boost::report_errors();