]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/units/test/test_unit.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / units / test / test_unit.cpp
CommitLineData
7c673cae
FG
1// Boost.Units - A C++ library for zero-overhead dimensional analysis and
2// unit/quantity manipulation and conversion
3//
4// Copyright (C) 2003-2008 Matthias Christian Schabel
5// Copyright (C) 2008 Steven Watanabe
6//
7// Distributed under the Boost Software License, Version 1.0. (See
8// accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt)
10
11/**
12\file
13
14\brief test_units_1.cpp
15
16\details
17Test unit class.
18
19Output:
20@verbatim
21@endverbatim
22**/
23
24#include "test_header.hpp"
25
26#include <boost/units/pow.hpp>
27
28namespace bu = boost::units;
29
1e59de90 30int main()
7c673cae 31{
11fdf7f2 32 BOOST_CONSTEXPR_OR_CONST bu::dimensionless D;
7c673cae 33
11fdf7f2
TL
34 BOOST_CONSTEXPR_OR_CONST bu::length L;
35 BOOST_CONSTEXPR_OR_CONST bu::mass M;
36 BOOST_CONSTEXPR_OR_CONST bu::time T;
7c673cae 37
1e59de90
TL
38 BOOST_TEST(+L == L);
39 BOOST_TEST(-L == L);
40 BOOST_TEST(L+L == L);
41 BOOST_TEST(L-L == L);
7c673cae 42
1e59de90
TL
43 BOOST_TEST(+M == M);
44 BOOST_TEST(-M == M);
45 BOOST_TEST(M+M == M);
46 BOOST_TEST(M-M == M);
7c673cae 47
11fdf7f2
TL
48 BOOST_CONSTEXPR_OR_CONST bu::area A;
49 BOOST_CONSTEXPR_OR_CONST bu::energy E;
50 BOOST_CONSTEXPR_OR_CONST bu::velocity V;
7c673cae 51
1e59de90
TL
52 BOOST_TEST(L*L == A);
53 BOOST_TEST(A == L*L);
7c673cae 54
1e59de90
TL
55 BOOST_TEST(L/L == D);
56 BOOST_TEST(D == L/L);
7c673cae 57
1e59de90
TL
58 BOOST_TEST(L/T == V);
59 BOOST_TEST(V == L/T);
7c673cae 60
1e59de90
TL
61 BOOST_TEST(M*L*L/T/T == E);
62 BOOST_TEST(M*(L/T)*(L/T) == E);
63 BOOST_TEST(M*bu::pow<2>(L/T) == E);
64 BOOST_TEST(bu::root<2>(E/M) == V);
7c673cae 65
1e59de90 66 return boost::report_errors();
7c673cae 67}