////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2004-2013. 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) // // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// #include #include "vector_test.hpp" #include "movable_int.hpp" #include "propagate_allocator_test.hpp" #include "default_init_test.hpp" #include #include #include #include namespace boost { namespace container { template class small_vector; template class small_vector; template class small_vector; template class small_vector; template class small_vector; template class small_vector; template class small_vector; template class small_vector; //Explicit instantiation to detect compilation errors template class boost::container::small_vector < test::movable_and_copyable_int , 10 , test::simple_allocator >; template class boost::container::small_vector < test::movable_and_copyable_int , 10 , test::dummy_test_allocator >; template class boost::container::small_vector < test::movable_and_copyable_int , 10 , std::allocator >; template class boost::container::small_vector < test::movable_and_copyable_int , 10 , allocator >; template class boost::container::small_vector < test::movable_and_copyable_int , 10 , adaptive_pool >; template class boost::container::small_vector < test::movable_and_copyable_int , 10 , node_allocator >; }} struct boost_container_small_vector; namespace boost { namespace container { namespace test { template<> struct alloc_propagate_base { template struct apply { typedef boost::container::small_vector type; }; }; }}} //namespace boost::container::test int main() { using namespace boost::container; /* typedef small_vector::storage_test storage_test; std::cout << "needed_extra_storages: " << storage_test::needed_extra_storages << '\n'; std::cout << "needed_bytes: " << storage_test::needed_bytes << '\n'; std::cout << "header_bytes: " << storage_test::header_bytes << '\n'; std::cout << "s_start: " << storage_test::s_start << '\n'; //char std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "\n"; //short std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; std::cout << "sizeof(small_vector): " << sizeof(small_vector) << " extra: " << small_vector::needed_extra_storages << " internal storage: " << small_vector::internal_capacity() << '\n'; */ if(test::vector_test< small_vector >()) return 1; if(test::vector_test< small_vector >()) return 1; //////////////////////////////////// // Default init test //////////////////////////////////// if(!test::default_init_test< vector > >()){ std::cerr << "Default init test failed" << std::endl; return 1; } //////////////////////////////////// // Emplace testing //////////////////////////////////// const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_BEFORE); if(!boost::container::test::test_emplace< vector, Options>()){ return 1; } //////////////////////////////////// // Allocator propagation testing //////////////////////////////////// if(!boost::container::test::test_propagate_allocator()){ return 1; } //////////////////////////////////// // Initializer lists testing //////////////////////////////////// if(!boost::container::test::test_vector_methods_with_initializer_list_as_argument_for< boost::container::vector >()) { return 1; } return 0; }