diff --git a/test/Jamfile b/test/Jamfile index 1aa6936..b389925 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -7,7 +7,7 @@ build-project container_fwd ; -project detail/test +project detail/test : requirements clang:-Wno-unused clang:-Wno-tautological-compare @@ -22,7 +22,11 @@ project detail/test import ../../config/checks/config : requires ; run binary_search_test.cpp ; +run blank_test.cpp ; run is_sorted_test.cpp ; run numeric_traits_test.cpp ; +run is_xxx_test.cpp ; # run test_utf8_codecvt.cpp : : : [ requires std_wstreambuf ] ; -run test_utf8_codecvt.cpp ; \ No newline at end of file +run test_utf8_codecvt.cpp ; +run allocator_utilities_test.cpp ; +run reference_content_test.cpp ; diff --git a/test/allocator_utilities_test.cpp b/test/allocator_utilities_test.cpp new file mode 100644 index 0000000..8649c54 --- /dev/null +++ b/test/allocator_utilities_test.cpp @@ -0,0 +1,40 @@ + +// Copyright 2018 Daniel James. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +typedef std::allocator std_int_allocator; +typedef typename boost::detail::allocator::rebind_to::type char_allocator; +typedef typename boost::detail::allocator::rebind_to::type int_allocator; +typedef typename boost::detail::allocator::rebind_to::type char_allocator2; + +int main() { + BOOST_STATIC_ASSERT((!boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + + // Check the constructors works okay + std_int_allocator a1; + char_allocator a2(a1); + char_allocator a2a(a2); + int_allocator a3(a2); + + // Check allocate works okay + { + typename char_allocator::pointer p = a2.allocate(10); + assert(p); + a2.deallocate(p, 10); + } + + // Try using the standalone construct/destroy + { + typename int_allocator::pointer p2 = a3.allocate(1); + boost::detail::allocator::construct(p2, 25); + assert(*p2 == 25); + boost::detail::allocator::destroy(p2); + a3.deallocate(p2, 1); + } +} diff --git a/test/blank_test.cpp b/test/blank_test.cpp new file mode 100644 index 0000000..c1cf033 --- /dev/null +++ b/test/blank_test.cpp @@ -0,0 +1,32 @@ + +// Copyright 2018 Daniel James. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +#if !defined(BOOST_NO_IOSTREAM) +#include +#endif + +int main() { + BOOST_STATIC_ASSERT((boost::is_pod::value)); + BOOST_STATIC_ASSERT((boost::is_empty::value)); + BOOST_STATIC_ASSERT((boost::is_stateless::value)); + + boost::blank b1,b2; + assert(b1 == b2); + assert(b1 <= b2); + assert(b1 >= b2); + assert(!(b1 != b2)); + assert(!(b1 < b2)); + assert(!(b1 > b2)); + +#if !defined(BOOST_NO_IOSTREAM) + std::stringstream s; + s << "(" << b1 << ")"; + assert(s.str() == "()"); +#endif +} diff --git a/test/is_xxx_test.cpp b/test/is_xxx_test.cpp new file mode 100644 index 0000000..2f2959c --- /dev/null +++ b/test/is_xxx_test.cpp @@ -0,0 +1,23 @@ + +// Copyright 2018 Daniel James. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +namespace is_xxx_test { + template struct thing1 {}; + template struct thing2 {}; +} + +BOOST_DETAIL_IS_XXX_DEF(thing1, is_xxx_test::thing1, 1); +BOOST_DETAIL_IS_XXX_DEF(thing2, is_xxx_test::thing2, 2); + +BOOST_STATIC_ASSERT((is_thing1 >::value)); +BOOST_STATIC_ASSERT((!is_thing1 >::value)); +BOOST_STATIC_ASSERT((!is_thing2 >::value)); +BOOST_STATIC_ASSERT((is_thing2 >::value)); +BOOST_STATIC_ASSERT((is_thing2 >::value)); + +int main() {} diff --git a/test/reference_content_test.cpp b/test/reference_content_test.cpp new file mode 100644 index 0000000..4d0f09a --- /dev/null +++ b/test/reference_content_test.cpp @@ -0,0 +1,16 @@ + +// Copyright 2018 Daniel James. +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +BOOST_STATIC_ASSERT((boost::is_same::type>::value)); +BOOST_STATIC_ASSERT((boost::is_same, boost::detail::make_reference_content::type>::value)); +BOOST_STATIC_ASSERT((boost::is_same::template apply::type>::value)); +BOOST_STATIC_ASSERT((boost::is_same, boost::detail::make_reference_content<>::template apply::type>::value)); +BOOST_STATIC_ASSERT((boost::has_nothrow_copy::type>::value)); + +int main() {}