mirror of
https://github.com/boostorg/container.git
synced 2026-07-05 12:00:46 +02:00
Make tests compatible with BOOST_NO_EXCEPTIONS
This commit is contained in:
@@ -1287,7 +1287,7 @@ public:
|
||||
//!
|
||||
//! <b>Postcondition</b>: capacity() >= n.
|
||||
//!
|
||||
//! <b>Throws</b>: length_error_t if n > max_size(), plus any exception
|
||||
//! <b>Throws</b>: if n > max_size(), plus any exception
|
||||
//! thrown by the allocator.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in the number of reserved blocks allocated.
|
||||
|
||||
@@ -16,6 +16,7 @@ int main() { return 0; }
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
#include <boost/container/hub.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/core/pointer_traits.hpp>
|
||||
@@ -384,9 +385,12 @@ void test(const typename Hub::allocator_type& al = {})
|
||||
BOOST_TEST_EQ(cx.capacity(), c);
|
||||
test_equal(x, x2);
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(cx.max_size() < (size_type)(-1)) {
|
||||
BOOST_TEST_THROWS(x.reserve(cx.max_size() + 1), std::length_error);
|
||||
BOOST_TEST_THROWS(
|
||||
x.reserve(cx.max_size() + 1), boost::container::length_error_t);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* available list partitioned in (non-empty)|(empty) */
|
||||
|
||||
@@ -6,7 +6,11 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if BOOST_CXX_VERSION < 201103L
|
||||
/* This test exercises exception safety, so it is meaningless (and would not
|
||||
* even compile, as it relies on try/catch and throw) when exceptions are
|
||||
* disabled.
|
||||
*/
|
||||
#if BOOST_CXX_VERSION < 201103L || defined(BOOST_NO_EXCEPTIONS)
|
||||
|
||||
int main() { return 0; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user