]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/core/assert.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2015 Oracle and/or its affiliates.
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
13 #include <geometry_test_common.hpp>
15 #define BOOST_GEOMETRY_ENABLE_ASSERT_HANDLER
16 #include <boost/geometry/core/assert.hpp>
18 struct assert_failure_exception
21 const char * what() const throw()
23 return "assertion failure";
27 namespace boost
{ namespace geometry
{
29 inline void assertion_failed(char const * expr
, char const * function
, char const * file
, long line
)
31 throw assert_failure_exception();
34 inline void assertion_failed_msg(char const * expr
, char const * msg
, char const * function
, char const * file
, long line
)
36 throw assert_failure_exception();
41 void fun1(bool condition
)
43 BOOST_GEOMETRY_ASSERT(condition
);
46 void fun2(bool condition
, const char* msg
= "")
48 BOOST_GEOMETRY_ASSERT_MSG(condition
, msg
);
51 bool is_ok(assert_failure_exception
const& ) { return true; }
53 int test_main(int, char* [])
58 BOOST_CHECK_EXCEPTION(fun1(a
== 2), assert_failure_exception
, is_ok
);
60 BOOST_CHECK_EXCEPTION(fun2(a
== 2), assert_failure_exception
, is_ok
);