diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/boost/libs/phoenix/test/container | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/phoenix/test/container')
25 files changed, 2416 insertions, 0 deletions
diff --git a/src/boost/libs/phoenix/test/container/container_tests.hpp b/src/boost/libs/phoenix/test/container/container_tests.hpp new file mode 100644 index 00000000..6dc6668e --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests.hpp @@ -0,0 +1,947 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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) +==============================================================================*/ +#if !defined(CONTAINER_TESTS_HPP) +#define CONTAINER_TESTS_HPP + +#include <boost/detail/lightweight_test.hpp> +#include <boost/phoenix/core.hpp> +#include <boost/phoenix/stl/container/container.hpp> + +#include <iostream> +#include <typeinfo> +#include <deque> +#include <list> +#include <map> +#include <set> +#include <vector> +#include <utility> +#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP +#include <unordered_map> +#endif +#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET +#include <unordered_set> +#endif + +#ifdef BOOST_MSVC +#pragma warning(disable : 4800) +#endif + +using std::cerr; +namespace phx = boost::phoenix; + +template <typename T> inline T const build_assoc(); + +std::deque<int> const build_deque(); +std::list<int> const build_list(); +std::map<int, int> const build_map(); +std::multimap<int, int> const build_multimap(); +std::vector<int> const build_vector(); +std::set<int> const build_set(); +std::multiset<int> const build_multiset(); +template <> inline std::map<int, int> const build_assoc() { return build_map(); } +template <> inline std::multimap<int, int> const build_assoc() { return build_multimap(); } +template <> inline std::set<int> const build_assoc() { return build_set(); } +template <> inline std::multiset<int> const build_assoc() { return build_multiset(); } +#ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP +std::unordered_map<int, int> const build_unordered_map(); +std::unordered_multimap<int, int> const build_unordered_multimap(); +template <> inline std::unordered_map<int, int> const build_assoc() { return build_unordered_map(); } +template <> inline std::unordered_multimap<int, int> const build_assoc() { return build_unordered_multimap(); } +#endif +#ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET +std::unordered_set<int> const build_unordered_set(); +std::unordered_multiset<int> const build_unordered_multiset(); +template <> inline std::unordered_set<int> const build_assoc() { return build_unordered_set(); } +template <> inline std::unordered_multiset<int> const build_assoc() { return build_unordered_multiset(); } +#endif + +inline bool +test(bool fail) +{ + BOOST_TEST(!fail); + return fail; +} + +template <typename Container> +void test_assign(Container c) +{ + using phx::arg_names::arg1; + + typename Container::size_type count = 2; + typename Container::const_iterator first = c.begin(); + typename Container::const_iterator second = first; + typename Container::value_type value = *first; + + phx::assign(arg1, count, value)(c); + + // iterators may be invalidated! + first = c.begin(); + second = first; + + std::advance(second, 1); + if (test(*first != *second)) { + cerr << "Failed " << typeid(Container).name() << " test_assign 1\n"; + return; + } +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + Container const const_c = c; + phx::assign(const_c, count, value); +#endif +} + +template <typename Container> +void test_assign2(Container c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::arg_names::arg3; + + Container c2 = c; + typename Container::const_iterator first = c2.begin(); + typename Container::const_iterator last = c2.end(); + typename Container::size_type size = c2.size(); + + c.clear(); + phx::assign(arg1, arg2, arg3)(c, first, last); + if (test(c.size() != size)) { + cerr << "Failed " << typeid(Container).name() + << " test_assign2 1\n" + << "size == " << c.size() << '\n'; + return; + } + +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + Container const const_c = c; + phx::assign(const_c, first, second); +#endif +} + +template <typename Container> +void test_at(Container c) +{ + using phx::arg_names::arg1; + using phx::at; + + typename Container::reference r1 = at(arg1, 0)(c); + if (test(r1 != c.at(0))) { + cerr << "Failed " << typeid(Container).name() << " test_at 1\n"; + return; + } + + typename Container::const_reference r2 = at(arg1, 0)(c); + if (test(r2 != c.at(0))) { + cerr << "Failed " << typeid(Container).name() << " test_at 2\n"; + return; + } + + Container const const_c = c; +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + typename Container::reference r3 = at(arg1, 0)(const_c); +#endif + + typename Container::const_reference r4 = at(arg1, 0)(const_c); + if (test(r4 != c.at(0))) { + cerr << "Failed " << typeid(Container).name() << " test_at 4\n"; + return; + } +} + +template <typename Container> +void test_back(Container c) +{ + using phx::arg_names::arg1; + using phx::back; + + typename Container::reference r1 = back(arg1)(c); + if (test(r1 != c.back())) { + cerr << "Failed " << typeid(Container).name() << " test_back 1\n"; + return; + } + typename Container::const_reference r2 = back(arg1)(c); + if (test(r2 != c.back())) { + cerr << "Failed " << typeid(Container).name() << " test_back 2\n"; + return; + } + + Container const const_c = c; +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + typename Container::reference r3 = back(arg1)(const_c); +#endif + + typename Container::const_reference r4 = back(arg1)(const_c); + if (test(r4 != c.back())) { + cerr << "Failed " << typeid(Container).name() << " test_back 4\n"; + return; + } +} + +template <typename Container> +void test_begin(Container c) +{ + using phx::arg_names::arg1; + using phx::begin; + + typename Container::iterator it1 = begin(arg1)(c); + if (test(it1 != c.begin())) { + cerr << "Failed " << typeid(Container).name() << " test_begin 1\n"; + return; + } + typename Container::const_iterator it2 = begin(arg1)(c); + if (test(it2 != c.begin())) { + cerr << "Failed " << typeid(Container).name() << " test_begin 2\n"; + return; + } + + Container const const_c = c; +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + typename Container::iterator it3 = begin(arg1)(const_c); +#endif + + typename Container::const_iterator it4 = begin(arg1)(const_c); + if (test(it4 != const_c.begin())) { + cerr << "Failed " << typeid(Container).name() << " test_begin 4\n"; + return; + } +} + +template <typename Container> +void test_capacity(Container c) +{ + using phx::arg_names::arg1; + using phx::capacity; + + typename Container::size_type s1 = capacity(arg1)(c); + if (test(s1 != c.capacity())) { + cerr << "Failed " << typeid(Container).name() << " test_capacity 1\n"; + return; + } + + Container const const_c = c; + typename Container::size_type s2 = capacity(arg1)(const_c); + if (test(s2 != const_c.capacity())) { + cerr << "Failed " << typeid(Container).name() << " test_capacity 2\n"; + return; + } +} + +template <typename Container> +void test_clear(Container c) +{ + using phx::arg_names::arg1; + using phx::clear; + + clear(arg1)(c); + if (test(!c.empty())) { + cerr << "Failed " << typeid(Container).name() << " test_clear 1\n"; + return; + } + +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + Container const const_c = c; + clear(arg1)(const_c); +#endif +} + +template <typename Container> +void test_empty(Container c) +{ + using phx::arg_names::arg1; + using phx::empty; + + typename Container::size_type s1 = empty(arg1)(c); + if (test(bool(s1) != c.empty())) { + cerr << "Failed " << typeid(Container).name() << " test_empty 1\n"; + return; + } + + Container const const_c = c; + typename Container::size_type s2 = empty(arg1)(const_c); + if (test(bool(s2) != const_c.empty())) { + cerr << "Failed " << typeid(Container).name() << " test_empty 2\n"; + return; + } +} + +template <typename Container> +void test_end(Container c) +{ + using phx::arg_names::arg1; + using phx::end; + + typename Container::iterator it1 = end(arg1)(c); + if (test(it1 != c.end())) { + cerr << "Failed " << typeid(Container).name() << " test_end 1\n"; + return; + } + typename Container::const_iterator it2 = end(arg1)(c); + if (test(it2 != c.end())) { + cerr << "Failed " << typeid(Container).name() << " test_end 2\n"; + return; + } + + Container const const_c = c; +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + typename Container::iterator it3 = end(arg1)(const_c); +#endif + + typename Container::const_iterator it4 = end(arg1)(const_c); + if (test(it4 != const_c.end())) { + cerr << "Failed " << typeid(Container).name() << " test_end 4\n"; + return; + } +} + +template <typename Container> +void test_erase(Container c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::arg_names::arg3; + using phx::erase; + + Container const const_c = c; + + typename Container::size_type size = c.size(); + typename Container::iterator c_begin = c.begin(); + erase(arg1, arg2)(c, c_begin); + if (test(c.size() + 1 != size)) { + cerr << "Failed " << typeid(Container).name() << " test_erase 1\n"; + return; + } + + c_begin = c.begin(); + typename Container::iterator c_end = c.end(); + erase(arg1, arg2, arg3)(c, c_begin, c_end); + if (test(!c.empty())) { + cerr << "Failed " << typeid(Container).name() << " test_erase 2\n"; + return; + } + +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + erase(arg1, const_c.begin())(const_c); + erase(arg1, const_c.begin(), const_c.end())(const_c); +#endif +} + +template <typename Container> +void test_map_erase(Container c) +{ + test_erase(c); + if (boost::report_errors() != 0) + return; + + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::erase; + + typename Container::value_type const value = *c.begin(); + typename Container::key_type const key = value.first; + typename Container::size_type const removed = + erase(arg1, arg2)(c, key); + if (test(removed != 1)) { + cerr << "Failed " << typeid(Container).name() << " test_map_erase 1\n"; + return; + } +} + +template <typename Container> +void test_set_erase(Container c) +{ + test_erase(c); + if (boost::report_errors() != 0) + return; + + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::erase; + + typename Container::value_type const value = *c.begin(); + typename Container::key_type const key = value; + typename Container::size_type const removed = + erase(arg1, arg2)(c, key); + if (test(removed != 1)) { + cerr << "Failed " << typeid(Container).name() << " test_set_erase 1\n"; + return; + } +} + +template <typename Container> +void test_front(Container c) +{ + using phx::arg_names::arg1; + using phx::front; + + typename Container::reference r1 = front(arg1)(c); + if (test(r1 != c.front())) { + cerr << "Failed " << typeid(Container).name() << " test_front 1\n"; + return; + } + typename Container::const_reference r2 = front(arg1)(c); + if (test(r2 != c.front())) { + cerr << "Failed " << typeid(Container).name() << " test_front 2\n"; + return; + } + + Container const const_c = c; +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + typename Container::reference r3 = front(arg1)(const_c); +#endif + + typename Container::const_reference r4 = front(arg1)(const_c); + if (test(r4 != c.front())) { + cerr << "Failed " << typeid(Container).name() << " test_front 4\n"; + return; + } +} + +template <typename Container> +void test_get_allocator(Container c) +{ + using phx::arg_names::arg1; + using phx::get_allocator; + + Container const const_c = c; + + typename Container::allocator_type a1 = get_allocator(arg1)(c); + if (test(a1 != c.get_allocator())) { + cerr << "Failed " << typeid(Container).name() << " test_get_allocator 1\n"; + return; + } + + typename Container::allocator_type a2 = get_allocator(arg1)(const_c); + if (test(a2 != const_c.get_allocator())) { + cerr << "Failed " << typeid(Container).name() << " test_get_allocator 2\n"; + return; + } +} + +template <typename Container> +void test_insert(Container c) +{ + using phx::arg_names::arg1; + using phx::insert; + + typename Container::value_type const value = *c.begin(); + typename Container::iterator it = insert(arg1, c.begin(), value)(c); + if (test(it != c.begin() || *it != *(++it))) { + cerr << "Failed " << typeid(Container).name() << " test_insert 1\n"; + return; + } + + typename Container::size_type size = c.size(); + insert(arg1, c.begin(), 3, value)(c); + if (test(c.size() != size + 3)) { + cerr << "Failed " << typeid(Container).name() << " test_insert 2\n"; + return; + } + + Container const const_c = c; + size = c.size(); + insert(arg1, c.begin(), const_c.begin(), const_c.end())(c); + if (test(c.size() != 2 * size)) { + cerr << "Failed " << typeid(Container).name() << " test_insert 3\n"; + return; + } +} + +template <typename Map> +inline void test_map_insert(Map c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::arg_names::arg3; + + typename Map::value_type const value = *c.begin(); + typename Map::iterator c_begin = c.begin(); + // wrapper for + // iterator insert(iterator where, const value_type& val); + typename Map::iterator it = + phx::insert(arg1, arg2, arg3)(c, c_begin, value); + + if (test(it != c.begin() /*|| *it != *(++it)*/)) { + cerr << "Failed " << typeid(Map).name() << " test_map_insert 1\n"; + return; + } + + // wrapper for + // pair<iterator, bool> insert(const value_type& val); + typename Map::value_type const value2(1400, 2200); + std::pair<typename Map::iterator, bool> result = + phx::insert(arg1, arg2)(c, value2); + if (test(!result.second)) { + cerr << "Failed " << typeid(Map).name() << " test_map_insert 2\n"; + return; + } + + // wrapper for + // template<class InIt> + // void insert(InIt first, InIt last); + Map const const_c = build_assoc<Map>(); + typename Map::size_type size = c.size(); + phx::insert(arg1, const_c.begin(), const_c.end())(c); + if (test(c.size() != size + const_c.size())) { + cerr << "Failed " << typeid(Map).name() << " test_map_insert 3\n"; + return; + } +} + +template <typename Multimap> +inline void test_multimap_insert(Multimap c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::arg_names::arg3; + + typename Multimap::value_type const value = *c.begin(); + typename Multimap::iterator c_begin = c.begin(); + std::size_t old_size = c.size(); + // wrapper for + // iterator insert(iterator where, const value_type& val); + typename Multimap::iterator it = + phx::insert(arg1, arg2, arg3)(c, c_begin, value); + + if (test(*it != value || c.size() != old_size + 1)) { + cerr << "Failed " << typeid(Multimap).name() + << " test_multimap_insert 1\n"; + return; + } + + // wrapper for + // iterator insert(const value_type& val); + typename Multimap::value_type const value2(1400, 2200); + it = phx::insert(arg1, arg2)(c, value2); + if (test(it == c.end())) { + cerr << "Failed " << typeid(Multimap).name() + << " test_multimap_insert 2\n"; + return; + } + + // wrapper for + // template<class InIt> + // void insert(InIt first, InIt last); + Multimap const const_c = build_assoc<Multimap>(); + typename Multimap::size_type size = c.size(); + phx::insert(arg1, const_c.begin(), const_c.end())(c); + if (test(c.size() != size + const_c.size())) { + cerr << "Failed " << typeid(Multimap).name() + << " test_multimap_insert 3\n"; + return; + } +} + +template <typename Set> +inline void test_set_insert(Set c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::arg_names::arg3; + + typename Set::value_type const value = *c.begin(); + typename Set::iterator c_begin = c.begin(); + // wrapper for + // iterator insert(iterator where, const value_type& val); + typename Set::iterator it = + phx::insert(arg1, arg2, arg3)(c, c_begin, value); + + if (test(it != c.begin() /*|| *it != *(++it)*/)) { + cerr << "Failed " << typeid(Set).name() << " test_set_insert 1\n"; + return; + } + + // wrapper for + // pair<iterator, bool> insert(const value_type& val); + typename Set::value_type const value2(1400); + std::pair<typename Set::iterator, bool> result = + phx::insert(arg1, arg2)(c, value2); + if (test(!result.second)) { + cerr << "Failed " << typeid(Set).name() << " test_set_insert 2\n"; + return; + } + + // wrapper for + // template<class InIt> + // void insert(InIt first, InIt last); + Set const const_c = build_assoc<Set>(); + typename Set::size_type size = c.size(); + phx::insert(arg1, const_c.begin(), const_c.end())(c); + if (test(c.size() != size + const_c.size())) { + cerr << "Failed " << typeid(Set).name() << " test_set_insert 3\n"; + return; + } +} + +template <typename Multiset> +inline void test_multiset_insert(Multiset c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::arg_names::arg3; + + typename Multiset::value_type const value = *c.begin(); + typename Multiset::iterator c_begin = c.begin(); + std::size_t old_size = c.size(); + // wrapper for + // iterator insert(iterator where, const value_type& val); + typename Multiset::iterator it = + phx::insert(arg1, arg2, arg3)(c, c_begin, value); + + if (test(*it != value || c.size() != old_size + 1)) { + cerr << "Failed " << typeid(Multiset).name() + << " test_multiset_insert 1\n"; + return; + } + + // wrapper for + // iterator insert(const value_type& val); + typename Multiset::value_type const value2(1400); + it = phx::insert(arg1, arg2)(c, value2); + if (test(it == c.end())) { + cerr << "Failed " << typeid(Multiset).name() + << " test_multiset_insert 2\n"; + return; + } + + // wrapper for + // template<class InIt> + // void insert(InIt first, InIt last); + Multiset const const_c = build_assoc<Multiset>(); + typename Multiset::size_type size = c.size(); + phx::insert(arg1, const_c.begin(), const_c.end())(c); + if (test(c.size() != size + const_c.size())) { + cerr << "Failed " << typeid(Multiset).name() + << " test_multiset_insert 3\n"; + return; + } +} + +template <typename Container> +void test_key_comp(Container c) +{ + using phx::arg_names::arg1; + using phx::key_comp; + + typename Container::key_compare comp = key_comp(arg1)(c); + + Container const const_c = c; + comp = key_comp(arg1)(const_c); +} + +template <typename Container> +void test_max_size(Container c) +{ + using phx::arg_names::arg1; + using phx::max_size; + + Container const const_c = c; + + typename Container::size_type s1 = max_size(arg1)(c); + if (test(s1 != c.max_size())) { + cerr << "Failed " << typeid(Container).name() << " test_max_size 1\n"; + return; + } + + typename Container::size_type s2 = max_size(arg1)(const_c); + if (test(s2 != const_c.max_size())) { + cerr << "Failed " << typeid(Container).name() << " test_max_size 2\n"; + return; + } +} + +template <typename Container> +void test_pop_back(Container c) +{ + using phx::arg_names::arg1; + using phx::pop_back; + + Container const const_c = c; + + typename Container::size_type size = c.size(); + + pop_back(arg1)(c); + if (test(c.size() + 1 != size)) { + cerr << "Failed " << typeid(Container).name() << " test_pop_back 1\n"; + return; + } + +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + pop_back(arg1)(const_c); +#endif +} + +template <typename Container> +void test_pop_front(Container c) +{ + using phx::arg_names::arg1; + using phx::pop_front; + + Container const const_c = c; + + typename Container::size_type size = c.size(); + + pop_front(arg1)(c); + if (test(c.size() + 1 != size)) { + cerr << "Failed " << typeid(Container).name() << " test_pop_front 1\n"; + return; + } +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + pop_front(arg1)(const_c); +#endif +} + +template <typename Container> +void test_push_back(Container c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::push_back; + + Container const const_c = c; + + typename Container::value_type data = *c.begin(); + typename Container::size_type size = c.size(); + push_back(arg1, arg2)(c, data); + if (test(c.size() != size + 1)) { + cerr << "Failed " << typeid(Container).name() << " test_push_back 1\n"; + return; + } +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + push_back(arg1, arg2)(const_c, data); +#endif +} + +template <typename Container> +void test_push_front(Container c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::push_front; + + Container const const_c = c; + + typename Container::value_type data = *c.begin(); + typename Container::size_type size = c.size(); + push_front(arg1, arg2)(c, data); + if (test(c.size() != size + 1)) { + cerr << "Failed " << typeid(Container).name() << " test_push_front 1\n"; + return; + } +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + push_front(arg1, arg2)(const_c, data); +#endif +} + +template <typename Container> +void test_rbegin(Container c) +{ + using phx::arg_names::arg1; + using phx::rbegin; + + typename Container::reverse_iterator it1 = rbegin(arg1)(c); + typename Container::reverse_iterator it1_test = c.rbegin(); + if (test(it1 != it1_test)) { + cerr << "Failed " << typeid(Container).name() << " test_rbegin 1\n"; + return; + } + typename Container::const_reverse_iterator it2 = rbegin(arg1)(c); + typename Container::const_reverse_iterator it2_test = c.rbegin(); + if (test(it2 != it2_test)) { + cerr << "Failed " << typeid(Container).name() << " test_rbegin 2\n"; + return; + } + + Container const const_c = c; +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + typename Container::reverse_iterator it3 = rbegin(arg1)(const_c); +#endif + + typename Container::const_reverse_iterator it4 = rbegin(arg1)(const_c); + it2_test = const_c.rbegin(); + if (test(it4 != it2_test)) { + cerr << "Failed " << typeid(Container).name() << " test_rbegin 4\n"; + return; + } +} + +template <typename Container> +void test_rend(Container c) +{ + using phx::arg_names::arg1; + using phx::rend; + + typename Container::reverse_iterator it1 = rend(arg1)(c); + typename Container::reverse_iterator it1_test = c.rend(); + if (test(it1 != it1_test)) { + cerr << "Failed " << typeid(Container).name() << " test_rend 1\n"; + return; + } + typename Container::const_reverse_iterator it2 = rend(arg1)(c); + typename Container::const_reverse_iterator it2_test = c.rend(); + if (test(it2 != it2_test)) { + cerr << "Failed " << typeid(Container).name() << " test_rend 2\n"; + return; + } + + Container const const_c = c; +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + // Should not --- does not, Yay! --- compile. + typename Container::reverse_iterator it3 = rend(arg1)(const_c); +#endif + + typename Container::const_reverse_iterator it4 = rend(arg1)(const_c); + it2_test = const_c.rend(); + if (test(it4 != it2_test)) { + cerr << "Failed " << typeid(Container).name() << " test_rend 4\n"; + return; + } +} + +template <typename Container> +void test_reserve(Container c) +{ + using phx::arg_names::arg1; + using phx::reserve; + + Container const const_c = c; + + typename Container::size_type count = 2 * c.size(); + reserve(arg1, count)(c); + if (test(c.capacity() < count)) { + cerr << "Failed " << typeid(Container).name() << " test_reserve 1\n"; + return; + } +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + reserve(arg1, count)(const_c)(const_c); +#endif +} + +template <typename Container> +void test_resize(Container c) +{ + using phx::arg_names::arg1; + using phx::resize; + + Container const const_c = c; + + typename Container::size_type new_size = 2 * c.size(); + resize(arg1, new_size)(c); + if (test(c.size() != new_size)) { + cerr << "Failed " << typeid(Container).name() << " test_resize 1\n"; + return; + } + + new_size = 2 * c.size(); + typename Container::value_type value = *c.begin(); + resize(arg1, new_size, value)(c); + if (test(c.size() != new_size)) { + cerr << "Failed " << typeid(Container).name() << " test_resize 2\n"; + return; + } +#if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST) + new_size = 2 * const_c.size(); + resize(arg1, new_size)(const_c); + + new_size = 2 * const_c.size(); + resize(arg1, new_size, value)(const_c); +#endif +} + +template <typename Container> +void test_size(Container c) +{ + using phx::arg_names::arg1; + using phx::size; + + Container const const_c = c; + + typename Container::size_type s1 = size(arg1)(c); + if (test(s1 != c.size())) { + cerr << "Failed " << typeid(Container).name() << " test_size 1\n"; + return; + } + + typename Container::size_type s2 = size(arg1)(const_c); + if (test(s2 != const_c.size())) { + cerr << "Failed " << typeid(Container).name() << " test_size 2\n"; + return; + } +} + +template <typename Container> +void test_splice(Container c) +{ + using phx::arg_names::arg1; + using phx::arg_names::arg2; + using phx::arg_names::arg3; + using phx::arg_names::arg4; + using phx::arg_names::arg5; + using phx::splice; + + typename Container::iterator c_end; + typename Container::iterator c2_begin; + typename Container::iterator c2_end; + typename Container::size_type size = c.size(); + + Container const copy = c; + Container const copy2 = build_list(); + Container c2 = copy2; + + size = c.size(); + c_end = c.end(); + splice(arg1, arg2, arg3)(c, c_end, c2); + if (test(c.size() != 2 * size)) { + cerr << "Failed " << typeid(Container).name() << " test_splice 1\n"; + return; + } + + c = copy; + c_end = c.end(); + c2 = copy2; + c2_begin = c2.begin(); + size = c.size() + 1; + splice(arg1, arg2, arg3, arg4)(c, c_end, c2, c2_begin); + if (test(c.size() != size)) { + cerr << "Failed " << typeid(Container).name() << " test_splice 2\n"; + return; + } + + c = copy; + c_end = c.end(); + c2 = copy2; + c2_begin = c2.begin(); + c2_end = c2.end(); + size = c.size() + c2.size(); + /* + splice(arg1, arg2, arg3, arg4, arg5)(c, c_end, c2, c2_begin, c2_end); + if (test(c.size() != size)) { + cerr << "Failed " << typeid(Container).name() << " test_splice 3\n"; + return; + } + */ +} + +template <typename Container> +void test_value_comp(Container c) +{ + using phx::arg_names::arg1; + using phx::value_comp; + + typename Container::value_compare comp = value_comp(arg1)(c); + + Container const const_c = c; + comp = value_comp(arg1)(const_c); +} + +#endif diff --git a/src/boost/libs/phoenix/test/container/container_tests10a.cpp b/src/boost/libs/phoenix/test/container/container_tests10a.cpp new file mode 100644 index 00000000..e7a06062 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests10a.cpp @@ -0,0 +1,73 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_map<int, int> const build_unordered_map() +{ + typedef std::unordered_map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::unordered_multimap<int, int> const build_unordered_multimap() +{ + typedef std::unordered_map<int, int> int_map; + typedef std::unordered_multimap<int, int> int_multimap; + int_map const data = build_unordered_map(); + return int_multimap(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::unordered_multimap<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_multimap<int, int> >::value)); + + std::unordered_multimap<int, int> const data = build_unordered_multimap(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_map_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests10b.cpp b/src/boost/libs/phoenix/test/container/container_tests10b.cpp new file mode 100644 index 00000000..5ff194a9 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests10b.cpp @@ -0,0 +1,74 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_map<int, int> const build_unordered_map() +{ + typedef std::unordered_map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::unordered_multimap<int, int> const build_unordered_multimap() +{ + typedef std::unordered_map<int, int> int_map; + typedef std::unordered_multimap<int, int> int_multimap; + int_map const data = build_unordered_map(); + return int_multimap(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::unordered_multimap<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_multimap<int, int> >::value)); + + std::unordered_multimap<int, int> const data = build_unordered_multimap(); + test_multimap_insert(data); + //test_key_comp(data); + test_max_size(data); + //test_rbegin(data); + //test_rend(data); + test_size(data); + //test_value_comp(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests11a.cpp b/src/boost/libs/phoenix/test/container/container_tests11a.cpp new file mode 100644 index 00000000..b89c3c8f --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests11a.cpp @@ -0,0 +1,59 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_set<int> const build_unordered_set() +{ + typedef std::unordered_set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::unordered_set<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_set<int> >::value)); + + std::unordered_set<int> const data = build_unordered_set(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_set_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests11b.cpp b/src/boost/libs/phoenix/test/container/container_tests11b.cpp new file mode 100644 index 00000000..53e2be9c --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests11b.cpp @@ -0,0 +1,60 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_set<int> const build_unordered_set() +{ + typedef std::unordered_set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::unordered_set<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_set<int> >::value)); + + std::unordered_set<int> const data = build_unordered_set(); + test_set_insert(data); + //test_key_comp(data); + test_max_size(data); + //test_rbegin(data); + //test_rend(data); + test_size(data); + //test_value_comp(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests12a.cpp b/src/boost/libs/phoenix/test/container/container_tests12a.cpp new file mode 100644 index 00000000..06c5d94e --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests12a.cpp @@ -0,0 +1,70 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_set<int> const build_unordered_set() +{ + typedef std::unordered_set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::unordered_multiset<int> const build_unordered_multiset() +{ + typedef std::unordered_set<int> int_set; + typedef std::unordered_multiset<int> int_multiset; + int_set const data = build_unordered_set(); + return int_multiset(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::unordered_multiset<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_multiset<int> >::value)); + + std::unordered_multiset<int> const data = build_unordered_multiset(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_set_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests12b.cpp b/src/boost/libs/phoenix/test/container/container_tests12b.cpp new file mode 100644 index 00000000..63f167c4 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests12b.cpp @@ -0,0 +1,71 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_set<int> const build_unordered_set() +{ + typedef std::unordered_set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::unordered_multiset<int> const build_unordered_multiset() +{ + typedef std::unordered_set<int> int_set; + typedef std::unordered_multiset<int> int_multiset; + int_set const data = build_unordered_set(); + return int_multiset(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::unordered_multiset<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_multiset<int> >::value)); + + std::unordered_multiset<int> const data = build_unordered_multiset(); + test_multiset_insert(data); + //test_key_comp(data); + test_max_size(data); + //test_rbegin(data); + //test_rend(data); + test_size(data); + //test_value_comp(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests1a.cpp b/src/boost/libs/phoenix/test/container/container_tests1a.cpp new file mode 100644 index 00000000..a4b1442b --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests1a.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" + +std::list<int> const build_list() +{ + std::vector<int> const data = build_vector(); + return std::list<int>(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::list<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::list<int> >::value)); + + std::list<int> const data = build_list(); + test_assign(data); + test_assign2(data); + test_back(data); + test_begin(data); + test_clear(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests1b.cpp b/src/boost/libs/phoenix/test/container/container_tests1b.cpp new file mode 100644 index 00000000..245fe0c3 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests1b.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" + +std::list<int> const build_list() +{ + std::vector<int> const data = build_vector(); + return std::list<int>(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::list<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::list<int> >::value)); + + std::list<int> const data = build_list(); + test_empty(data); + test_end(data); + test_erase(data); + test_front(data); + test_get_allocator(data); + test_insert(data); + test_max_size(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests2a.cpp b/src/boost/libs/phoenix/test/container/container_tests2a.cpp new file mode 100644 index 00000000..757444a7 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests2a.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" + +std::list<int> const build_list() +{ + std::vector<int> const data = build_vector(); + return std::list<int>(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::list<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::list<int> >::value)); + + std::list<int> const data = build_list(); + test_pop_back(data); + test_pop_front(data); + test_push_back(data); + test_push_front(data); + return boost::report_errors(); +} + + diff --git a/src/boost/libs/phoenix/test/container/container_tests2b.cpp b/src/boost/libs/phoenix/test/container/container_tests2b.cpp new file mode 100644 index 00000000..c0e48190 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests2b.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" + +std::list<int> const build_list() +{ + std::vector<int> const data = build_vector(); + return std::list<int>(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::list<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::list<int> >::value)); + + std::list<int> const data = build_list(); + test_rbegin(data); + test_rend(data); + test_resize(data); + test_size(data); + test_splice(data); + return boost::report_errors(); +} + + diff --git a/src/boost/libs/phoenix/test/container/container_tests3a.cpp b/src/boost/libs/phoenix/test/container/container_tests3a.cpp new file mode 100644 index 00000000..348b6552 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests3a.cpp @@ -0,0 +1,61 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::map<int, int> const build_map() +{ + typedef std::map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::map<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::map<int, int> >::value)); + + std::map<int, int> const data = build_map(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_map_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests3b.cpp b/src/boost/libs/phoenix/test/container/container_tests3b.cpp new file mode 100644 index 00000000..98c3c65a --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests3b.cpp @@ -0,0 +1,62 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::map<int, int> const build_map() +{ + typedef std::map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::map<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::map<int, int> >::value)); + + std::map<int, int> const data = build_map(); + test_map_insert(data); + test_key_comp(data); + test_max_size(data); + test_rbegin(data); + test_rend(data); + test_size(data); + test_value_comp(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests4a.cpp b/src/boost/libs/phoenix/test/container/container_tests4a.cpp new file mode 100644 index 00000000..3d252d7c --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests4a.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::vector<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::vector<int> >::value)); + + std::vector<int> const data = build_vector(); + test_assign(data); + test_assign2(data); + test_at(data); + test_back(data); + test_begin(data); + test_capacity(data); + test_clear(data); + test_end(data); + test_empty(data); + test_erase(data); + test_front(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests4b.cpp b/src/boost/libs/phoenix/test/container/container_tests4b.cpp new file mode 100644 index 00000000..07059b38 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests4b.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::vector<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::vector<int> >::value)); + + std::vector<int> const data = build_vector(); + test_get_allocator(data); + test_insert(data); + test_max_size(data); + test_pop_back(data); + test_push_back(data); + test_rbegin(data); + test_rend(data); + test_reserve(data); + test_resize(data); + test_size(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests5a.cpp b/src/boost/libs/phoenix/test/container/container_tests5a.cpp new file mode 100644 index 00000000..983913a4 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests5a.cpp @@ -0,0 +1,56 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" + +std::deque<int> const build_deque() +{ + std::vector<int> const data = build_vector(); + return std::deque<int>(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::deque<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::deque<int> >::value)); + + std::deque<int> const data = build_deque(); + test_assign(data); + test_assign2(data); + test_at(data); + test_back(data); + test_begin(data); + test_clear(data); + test_front(data); + test_empty(data); + test_end(data); + test_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + + diff --git a/src/boost/libs/phoenix/test/container/container_tests5b.cpp b/src/boost/libs/phoenix/test/container/container_tests5b.cpp new file mode 100644 index 00000000..d08a7016 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests5b.cpp @@ -0,0 +1,55 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" + +std::deque<int> const build_deque() +{ + std::vector<int> const data = build_vector(); + return std::deque<int>(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::deque<int> >::value)); + BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::deque<int> >::value)); + + std::deque<int> const data = build_deque(); + test_insert(data); + test_max_size(data); + test_pop_back(data); + test_pop_front(data); + test_push_back(data); + test_push_front(data); + test_rbegin(data); + test_rend(data); + test_resize(data); + test_size(data); + return boost::report_errors(); +} + + diff --git a/src/boost/libs/phoenix/test/container/container_tests6a.cpp b/src/boost/libs/phoenix/test/container/container_tests6a.cpp new file mode 100644 index 00000000..62c8af18 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests6a.cpp @@ -0,0 +1,72 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::map<int, int> const build_map() +{ + typedef std::map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::multimap<int, int> const build_multimap() +{ + typedef std::map<int, int> int_map; + typedef std::multimap<int, int> int_multimap; + int_map const data = build_map(); + return int_multimap(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::multimap<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::multimap<int, int> >::value)); + + std::multimap<int, int> const data = build_multimap(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_map_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests6b.cpp b/src/boost/libs/phoenix/test/container/container_tests6b.cpp new file mode 100644 index 00000000..193f4bf4 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests6b.cpp @@ -0,0 +1,73 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::map<int, int> const build_map() +{ + typedef std::map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::multimap<int, int> const build_multimap() +{ + typedef std::map<int, int> int_map; + typedef std::multimap<int, int> int_multimap; + int_map const data = build_map(); + return int_multimap(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::multimap<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::multimap<int, int> >::value)); + + std::multimap<int, int> const data = build_multimap(); + test_multimap_insert(data); + test_key_comp(data); + test_max_size(data); + test_rbegin(data); + test_rend(data); + test_size(data); + test_value_comp(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests7a.cpp b/src/boost/libs/phoenix/test/container/container_tests7a.cpp new file mode 100644 index 00000000..b82b4cf1 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests7a.cpp @@ -0,0 +1,59 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::set<int> const build_set() +{ + typedef std::set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::set<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::set<int> >::value)); + + std::set<int> const data = build_set(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_set_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests7b.cpp b/src/boost/libs/phoenix/test/container/container_tests7b.cpp new file mode 100644 index 00000000..a79be9e9 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests7b.cpp @@ -0,0 +1,60 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::set<int> const build_set() +{ + typedef std::set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::set<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::set<int> >::value)); + + std::set<int> const data = build_set(); + test_set_insert(data); + test_key_comp(data); + test_max_size(data); + test_rbegin(data); + test_rend(data); + test_size(data); + test_value_comp(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests8a.cpp b/src/boost/libs/phoenix/test/container/container_tests8a.cpp new file mode 100644 index 00000000..95e85b83 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests8a.cpp @@ -0,0 +1,70 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::set<int> const build_set() +{ + typedef std::set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::multiset<int> const build_multiset() +{ + typedef std::set<int> int_set; + typedef std::multiset<int> int_multiset; + int_set const data = build_set(); + return int_multiset(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::multiset<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::multiset<int> >::value)); + + std::multiset<int> const data = build_multiset(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_set_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests8b.cpp b/src/boost/libs/phoenix/test/container/container_tests8b.cpp new file mode 100644 index 00000000..b20ed5d3 --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests8b.cpp @@ -0,0 +1,71 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::set<int> const build_set() +{ + typedef std::set<int> int_set; + typedef std::vector<int> int_vector; + + int_set result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + result.insert(it, end); + return result; +} + +std::multiset<int> const build_multiset() +{ + typedef std::set<int> int_set; + typedef std::multiset<int> int_multiset; + int_set const data = build_set(); + return int_multiset(data.begin(), data.end()); +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::multiset<int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::multiset<int> >::value)); + + std::multiset<int> const data = build_multiset(); + test_multiset_insert(data); + test_key_comp(data); + test_max_size(data); + test_rbegin(data); + test_rend(data); + test_size(data); + test_value_comp(data); + return boost::report_errors(); +} + + + + diff --git a/src/boost/libs/phoenix/test/container/container_tests9a.cpp b/src/boost/libs/phoenix/test/container/container_tests9a.cpp new file mode 100644 index 00000000..5711c49d --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests9a.cpp @@ -0,0 +1,62 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_map<int, int> const build_unordered_map() +{ + typedef std::unordered_map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::unordered_map<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_map<int, int> >::value)); + + std::unordered_map<int, int> const data = build_unordered_map(); + test_begin(data); + test_clear(data); + test_empty(data); + test_end(data); + test_map_erase(data); + test_get_allocator(data); + return boost::report_errors(); +} + diff --git a/src/boost/libs/phoenix/test/container/container_tests9b.cpp b/src/boost/libs/phoenix/test/container/container_tests9b.cpp new file mode 100644 index 00000000..fcc2d56f --- /dev/null +++ b/src/boost/libs/phoenix/test/container/container_tests9b.cpp @@ -0,0 +1,63 @@ +/*============================================================================= + Copyright (c) 2004 Angus Leeming + Copyright (c) 2017 Kohei Takahashi + + 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 "container_tests.hpp" +#include <boost/static_assert.hpp> + +std::unordered_map<int, int> const build_unordered_map() +{ + typedef std::unordered_map<int, int> int_map; + typedef std::vector<int> int_vector; + + int_map result; + int_vector const data = build_vector(); + int_vector::const_iterator it = data.begin(); + int_vector::const_iterator const end = data.end(); + for (; it != end; ++it) { + int const value = *it; + result[value] = 100 * value; + } + return result; +} + +std::vector<int> const init_vector() +{ + typedef std::vector<int> int_vector; + int const data[] = { -4, -3, -2, -1, 0 }; + int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]); + return int_vector(data, data + data_size); +} + +std::vector<int> const build_vector() +{ + typedef std::vector<int> int_vector; + static int_vector data = init_vector(); + int_vector::size_type const size = data.size(); + int_vector::iterator it = data.begin(); + int_vector::iterator const end = data.end(); + for (; it != end; ++it) + *it += size; + return data; +} + +int +main() +{ + BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::unordered_map<int, int> >::value)); + BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_map<int, int> >::value)); + + std::unordered_map<int, int> const data = build_unordered_map(); + test_map_insert(data); + //test_key_comp(data); + test_max_size(data); + //test_rbegin(data); + //test_rend(data); + test_size(data); + //test_value_comp(data); + return boost::report_errors(); +} + |