]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/chrono/test/duration/typedefs_pass.cpp
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
15 #include <boost/chrono/duration.hpp>
16 #include <boost/type_traits.hpp>
19 #if !defined(BOOST_NO_CXX11_STATIC_ASSERT)
23 template <typename D
, int ExpectedDigits
, typename ExpectedPeriod
>
26 typedef typename
D::rep Rep
;
27 typedef typename
D::period Period
;
28 BOOST_CHRONO_STATIC_ASSERT(boost::is_signed
<Rep
>::value
, NOTHING
, ());
29 BOOST_CHRONO_STATIC_ASSERT(boost::is_integral
<Rep
>::value
, NOTHING
, ());
30 BOOST_CHRONO_STATIC_ASSERT(std::numeric_limits
<Rep
>::digits
>= ExpectedDigits
, NOTHING
, ());
31 BOOST_CHRONO_STATIC_ASSERT((boost::is_same
<Period
, ExpectedPeriod
>::value
), NOTHING
, ());
36 check_duration
<boost::chrono::hours
, 22, boost::ratio
<3600> >();
37 check_duration
<boost::chrono::minutes
, 28, boost::ratio
<60> >();
38 check_duration
<boost::chrono::seconds
, 34, boost::ratio
<1> >();
39 check_duration
<boost::chrono::milliseconds
, 44, boost::milli
>();
40 check_duration
<boost::chrono::microseconds
, 54, boost::micro
>();
41 check_duration
<boost::chrono::nanoseconds
, 63, boost::nano
>();