]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/chrono/test/duration/duration_values_pass.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / chrono / test / duration / duration_values_pass.cpp
CommitLineData
7c673cae
FG
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// 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
13
14#include <boost/chrono/duration.hpp>
15#include <boost/detail/lightweight_test.hpp>
16
17#include "../rep.h"
18#if defined BOOST_NO_CXX11_NUMERIC_LIMITS || defined BOOST_NO_CXX11_CONSTEXPR
19#define BOOST_CONSTEXPR_ASSERT(C) BOOST_TEST(C)
20#else
21#include <boost/static_assert.hpp>
22#define BOOST_CONSTEXPR_ASSERT(C) BOOST_STATIC_ASSERT(C)
23#endif
24
25template <class D>
26void check_max()
27{
28 typedef typename D::rep Rep;
29 Rep max_rep = (boost::chrono::duration_values<Rep>::max)();
30 BOOST_TEST((D::max)().count() == max_rep);
31 {
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);
35 }
36}
37
38template <class D>
39void check_min()
40{
41 typedef typename D::rep Rep;
42 Rep min_rep = (boost::chrono::duration_values<Rep>::min)();
43 BOOST_TEST((D::min)().count() == min_rep);
44 {
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);
48
49 }
50}
51
52template <class D>
53void check_zero()
54{
55 typedef typename D::rep Rep;
56 Rep zero_rep = boost::chrono::duration_values<Rep>::zero();
57 BOOST_TEST(D::zero().count() == zero_rep);
58 {
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);
62
63 }
64}
65
66
67int main()
68{
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();
76}