Converted allocator_utilities_test to lightweight_test.hpp

This commit is contained in:
Andrey Semashev
2020-05-10 23:20:53 +03:00
parent 5f456ffe33
commit f26a04df65

View File

@ -5,14 +5,17 @@
#include <boost/detail/allocator_utilities.hpp>
#include <boost/static_assert.hpp>
#include <cassert>
#include <boost/core/lightweight_test.hpp>
#include <boost/type_traits/is_same.hpp>
#include <memory>
typedef std::allocator<int> std_int_allocator;
typedef boost::detail::allocator::rebind_to<std_int_allocator, char>::type char_allocator;
typedef boost::detail::allocator::rebind_to<char_allocator, int>::type int_allocator;
typedef boost::detail::allocator::rebind_to<int_allocator, char>::type char_allocator2;
int main() {
int main()
{
BOOST_STATIC_ASSERT((!boost::is_same<char_allocator, int_allocator>::value));
BOOST_STATIC_ASSERT((boost::is_same<char_allocator, char_allocator2>::value));
@ -25,7 +28,7 @@ int main() {
// Check allocate works okay
{
char_allocator::pointer p = a2.allocate(10);
assert(p);
BOOST_TEST(!!p);
a2.deallocate(p, 10);
}
@ -33,8 +36,10 @@ int main() {
{
int_allocator::pointer p2 = a3.allocate(1);
boost::detail::allocator::construct(p2, 25);
assert(*p2 == 25);
BOOST_TEST(*p2 == 25);
boost::detail::allocator::destroy(p2);
a3.deallocate(p2, 1);
}
return boost::report_errors();
}