]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/stdlib/cmath.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / phoenix / test / stdlib / cmath.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
3 Copyright (c) 2014 John Fletcher
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8
9 #include <cmath>
10 #include <boost/function.hpp>
11 #include <boost/phoenix/core.hpp>
12 #include <boost/phoenix/operator.hpp>
13 #include <boost/phoenix/stl/cmath.hpp>
14 #include <boost/core/lightweight_test.hpp>
15
16 int main()
17 {
18 double eps = 0.000001;
19 using namespace boost::phoenix::arg_names;
20 boost::function<bool(double, double)> f = boost::phoenix::fabs(_1 - _2) < eps;
21
22 double x = boost::phoenix::pow(_1,_2)(2.,2.);
23 double y = boost::phoenix::atan2(_1,_2)(1.,1.);
24 double z = boost::phoenix::tan(_1)(y);
25
26 BOOST_TEST(f(0.0, 0 * eps));
27 BOOST_TEST(!f(0.0, eps));
28 BOOST_TEST(std::fabs(x-4.) < eps );
29 BOOST_TEST(std::fabs(z-1.) < eps );
30 return boost::report_errors();
31 }