diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-28 01:23:58 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-28 01:23:58 +0000 |
commit | ce8b0a77329373909bac9fd6da9d7fa46605069e (patch) | |
tree | ef3e103ee11eb8b6a01a51a23e8726e0d33c90d4 /libstdc++-v3/testsuite/util/regression | |
parent | a96763ff13bcc0b3cecee2beacda000818a1f02f (diff) | |
download | ppe42-gcc-ce8b0a77329373909bac9fd6da9d7fa46605069e.tar.gz ppe42-gcc-ce8b0a77329373909bac9fd6da9d7fa46605069e.zip |
2006-09-27 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/typelist.h (type_to_type): Remove.
* include/ext/throw_allocator.h (assert_allocatod): Remove.
(check_allocated(label)): New.
(print_to_string): Print numerical output correctly.
* testsuite/ext/pb_ds/example/hash_resize_neg.cc: Adjust line numbers.
* testsuite/util/regression/rand/priority_queue/detail/
operator_fn_imps.hpp: Set and clear label, throw
probability. Check only allocations of the marked label.
* testsuite/util/regression/rand/assoc/detail/
operator_fn_imps.hpp: Same.
* testsuite/performance/ext/pb_ds/text_find_timing.cc: Adjustments for
removal of type_to_type.
* testsuite/performance/ext/pb_ds/
hash_random_int_erase_mem_usage.cc: Same.
* testsuite/performance/ext/pb_ds/tree_text_insert_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
priority_queue_text_push_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
random_int_subscript_find_timing.cc: Same.
* testsuite/performance/ext/pb_ds/tree_split_join_timing.cc: Same.
* testsuite/performance/ext/pb_ds/random_int_find_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
multimap_text_insert_mem_usage.hpp: Same.
* testsuite/performance/ext/pb_ds/
priority_queue_random_int_push_timing.cc: Same.
* testsuite/performance/ext/pb_ds/multimap_text_find_timing.hpp: Same.
* testsuite/performance/ext/pb_ds/
priority_queue_text_modify_timing.hpp: Same.
* testsuite/performance/ext/pb_ds/
tree_order_statistics_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
priority_queue_text_push_pop_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
priority_queue_text_join_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
priority_queue_random_int_push_pop_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
random_int_subscript_insert_timing.cc: Same.
* testsuite/performance/ext/pb_ds/tree_text_lor_find_timing.cc: Same.
* testsuite/performance/ext/pb_ds/
multimap_text_insert_timing.hpp: Same.
* testsuite/performance/ext/pb_ds/
priority_queue_text_pop_mem_usage.cc: Same.
* testsuite/performance/ext/pb_ds/
hash_zlob_random_int_find_timing.cc: Same.
* testsuite/util/regression/trait/assoc/type_trait.hpp: Same.
* testsuite/util/regression/rand/priority_queue/
rand_regression_test.hpp: Same.
* testsuite/util/regression/rand/assoc/detail/
constructor_destructor_fn_imps.hpp: Same.
* testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp: Same.
* testsuite/util/regression/rand/assoc/rand_regression_test.hpp: Same.
* testsuite/util/regression/rand/assoc/
container_rand_regression_test.hpp: Same.
* testsuite/util/regression/assoc/common_type.hpp: Same.
* testsuite/util/regression/basic_type.hpp: Same.
* testsuite/util/common_type/assoc/common_type.hpp: Same.
* testsuite/util/common_type/assoc/string_form.hpp: Same.
* testsuite/util/common_type/assoc/template_policy.hpp: Same.
* testsuite/util/common_type/assoc/native_set.hpp: Same.
* testsuite/util/performance/priority_queue/mem_usage/
pop_test.hpp: Same.
* testsuite/util/performance/priority_queue/timing/
push_pop_test.hpp: Same.
* testsuite/util/performance/priority_queue/timing/join_test.hpp: Same.
* testsuite/util/performance/priority_queue/timing/push_test.hpp: Same.
* testsuite/util/performance/priority_queue/timing/
modify_test.hpp: Same.
* testsuite/util/performance/assoc/mem_usage/
multimap_insert_test.hpp: Same.
* testsuite/util/performance/assoc/mem_usage/erase_test.hpp: Same.
* testsuite/util/performance/assoc/timing/
multimap_insert_test.hpp: Same.
* testsuite/util/performance/assoc/timing/
subscript_find_test.hpp: Same.
* testsuite/util/performance/assoc/timing/find_test.hpp: Same.
* testsuite/util/performance/assoc/timing/
subscript_insert_test.hpp: Same.
* testsuite/util/performance/assoc/timing/insert_test.hpp: Same.
* testsuite/util/performance/assoc/timing/
tree_order_statistics_test.hpp: Same.
* testsuite/util/performance/assoc/timing/multimap_find_test.hpp: Same.
* testsuite/util/performance/assoc/timing/
tree_split_join_test.hpp: Same.
* testsuite/util/performance/assoc/multimap_common_type.hpp: Same.
* testsuite/util/testsuite_common_types.h: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
constructor_destructor_no_store_hash_fn_imps.hpp: Typedef
normalization, consistency in member names between cc and gp hash
tables, formatting fixes.
* include/ext/pb_ds/detail/cc_hash_table_map_/
erase_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
insert_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
constructor_destructor_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
insert_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/
erase_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
constructor_destructor_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
erase_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
insert_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
constructor_destructor_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
insert_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
erase_no_store_hash_fn_imps.hpp: Same.
* include/ext/pb_ds/assoc_container.hpp: Formatting fixes.
* include/ext/pb_ds/detail/resize_policy/
hash_prime_size_policy_imp.hpp: Same.
* include/ext/pb_ds/detail/resize_policy/
hash_standard_resize_policy_imp.hpp: Same.
* include/ext/pb_ds/detail/types_traits.hpp: Same.
* include/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/
direct_mod_range_hashing_imp.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp: Same.
* include/ext/pb_ds/detail/hash_fn/
direct_mask_range_hashing_imp.hpp: Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117268 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/util/regression')
10 files changed, 171 insertions, 319 deletions
diff --git a/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp b/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp index e62bf409c10..0f86f38da3d 100644 --- a/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp +++ b/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp @@ -58,13 +58,14 @@ namespace test struct hash { - typedef alloc_type::rebind<basic_type>::other::const_reference const_key_reference; + typedef alloc_type::rebind<basic_type>::other basic_type_rebind; + typedef basic_type_rebind::const_reference const_reference; + typedef basic_type::const_iterator const_iterator; size_t - operator()(const_key_reference r_key) const + operator()(const_reference r_key) const { size_t ret = 0; - typedef basic_type::const_iterator const_iterator; for (const_iterator it = r_key.begin(); it != r_key.end(); ++it) ret = ret * 5 + static_cast<size_t>(*it); return ret; @@ -141,4 +142,4 @@ namespace test } // namespace test } // namespace pb_ds -#endif // #ifndef PB_DS_RAND_REGRESSION_TEST_COMMON_TYPE_HPP +#endif diff --git a/libstdc++-v3/testsuite/util/regression/basic_type.hpp b/libstdc++-v3/testsuite/util/regression/basic_type.hpp index 279c28809e4..ad93bf47142 100644 --- a/libstdc++-v3/testsuite/util/regression/basic_type.hpp +++ b/libstdc++-v3/testsuite/util/regression/basic_type.hpp @@ -101,4 +101,4 @@ namespace test } // namespace test } // namespace pb_ds -#endif // #ifndef PB_DS_BASIC_TYPE_HPP +#endif diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp index d53ce348e65..3f77c219e00 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp @@ -128,25 +128,17 @@ namespace detail operator()(); private: - typedef Cntnr cntnr; - - typedef typename cntnr::allocator allocator; - - typedef typename cntnr::size_type size_type; - - typedef twister_rand_gen gen; - - typedef regression_test_traits<Cntnr> test_traits; - - typedef pb_ds::container_traits<Cntnr> container_traits; - - typedef typename test_traits::key_type key_type; - - typedef typename test_traits::const_key_reference const_key_reference; - - typedef typename test_traits::value_type value_type; - - typedef typename test_traits::native_type native_type; + typedef Cntnr cntnr; + typedef typename cntnr::allocator allocator; + typedef typename cntnr::size_type size_type; + typedef regression_test_traits<Cntnr> test_traits; + typedef typename test_traits::key_type key_type; + typedef typename test_traits::const_key_reference const_key_reference; + typedef typename test_traits::value_type value_type; + typedef typename test_traits::native_type native_type; + typedef twister_rand_gen gen; + typedef pb_ds::container_traits<Cntnr> container_traits; + typedef __gnu_cxx::throw_allocator<char> alloc_t; enum op { @@ -156,10 +148,6 @@ namespace detail other_op }; - typedef __gnu_cxx::throw_allocator<char> alloc_t; - - private: - op get_next_op(); @@ -440,7 +428,6 @@ namespace detail void print_container(const cntnr&, std::ostream& r_os = std::cerr) const; - private: struct destructor_printer { destructor_printer(const std::string& r_msg) @@ -464,27 +451,20 @@ namespace detail bool m_print; }; - private: - const unsigned long m_seed; - - const size_t m_n; - const size_t m_m; - const double m_tp; - const double m_ip; - const double m_ep; - const double m_cp; - const double m_mp; - const bool m_disp; - - twister_rand_gen m_g; - - Cntnr* m_p_c; - - native_type m_native_c; - - alloc_t m_alloc; - - size_t m_i; + const unsigned long m_seed; + const size_t m_n; + const size_t m_m; + const double m_tp; + const double m_ip; + const double m_ep; + const double m_cp; + const double m_mp; + const bool m_disp; + twister_rand_gen m_g; + Cntnr* m_p_c; + native_type m_native_c; + alloc_t m_alloc; + size_t m_i; }; #include <regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp> diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp index 00f74bbb4a4..66a7077470f 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp @@ -46,19 +46,12 @@ PB_DS_CLASS_T_DEC PB_DS_CLASS_C_DEC:: -container_rand_regression_test(unsigned long seed, size_t n, size_t m, double tp, double ip, double ep, double cp, double mp, bool disp) : - m_seed((seed == 0)? - twister_rand_gen::get_time_determined_seed(): - seed), - m_n(n), - m_m(m), - m_tp(tp), - m_ip(ip), - m_ep(ep), - m_cp(cp), - m_mp(mp), - m_disp(disp), - m_p_c(NULL) +container_rand_regression_test(unsigned long seed, size_t n, size_t m, + double tp, double ip, double ep, double cp, + double mp, bool disp) +: m_seed((seed == 0) ? twister_rand_gen::get_time_determined_seed() : seed), + m_n(n), m_m(m), m_tp(tp), m_ip(ip), m_ep(ep), m_cp(cp), m_mp(mp), + m_disp(disp), m_p_c(NULL) { } PB_DS_CLASS_T_DEC @@ -72,24 +65,21 @@ PB_DS_CLASS_C_DEC:: default_constructor() { PB_DS_TRACE("default_constructor"); - bool done = true; - m_alloc.set_throw_prob(m_tp); try { m_p_c = new Cntnr; } - catch(__gnu_cxx::forced_exception_error& ) + catch(__gnu_cxx::forced_exception_error&) { done = false; } if (m_p_c != NULL) PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } PB_DS_CLASS_T_DEC @@ -98,19 +88,12 @@ PB_DS_CLASS_C_DEC:: swap() { PB_DS_TRACE("swap"); - m_alloc.set_throw_prob(0); - Cntnr* p_c = new Cntnr; - m_alloc.set_throw_prob(1); - p_c->swap(*m_p_c); - std::swap(p_c, m_p_c); - delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); } @@ -120,20 +103,14 @@ PB_DS_CLASS_C_DEC:: copy_constructor() { PB_DS_TRACE("copy_constructor"); - bool done = true; - Cntnr* p_c = NULL; - m_alloc.set_throw_prob(m_tp); - - typename alloc_t::group_throw_prob_adjustor - adjust(m_p_c->size()); + typename alloc_t::group_throw_prob_adjustor adjust(m_p_c->size()); try { p_c = new Cntnr(*m_p_c); - std::swap(p_c, m_p_c); } catch(__gnu_cxx::forced_exception_error& ) @@ -142,10 +119,8 @@ copy_constructor() } delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } PB_DS_CLASS_T_DEC @@ -154,22 +129,15 @@ PB_DS_CLASS_C_DEC:: assignment_operator() { PB_DS_TRACE("assignment operator"); - bool done = true; - Cntnr* p_c = NULL; - m_alloc.set_throw_prob(m_tp); - - typename alloc_t::group_throw_prob_adjustor - adjust(m_p_c->size()); + typename alloc_t::group_throw_prob_adjustor adjust(m_p_c->size()); try { p_c = new Cntnr(); - * p_c =* m_p_c; - std::swap(p_c, m_p_c); } catch(__gnu_cxx::forced_exception_error& ) @@ -178,10 +146,8 @@ assignment_operator() } delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } PB_DS_CLASS_T_DEC @@ -190,8 +156,7 @@ PB_DS_CLASS_C_DEC:: it_constructor() { PB_DS_TRACE("it_constructor"); - - return (it_constructor_imp(typename Cntnr::container_category())); + return it_constructor_imp(typename Cntnr::container_category()); } PB_DS_CLASS_T_DEC @@ -200,13 +165,9 @@ PB_DS_CLASS_C_DEC:: it_constructor_imp(pb_ds::cc_hash_tag) { bool done = true; - Cntnr* p_c = NULL; - m_alloc.set_throw_prob(m_tp); - - typename alloc_t::group_throw_prob_adjustor - adjust(m_p_c->size()); + typename alloc_t::group_throw_prob_adjustor adjust(m_p_c->size()); try { @@ -217,69 +178,52 @@ it_constructor_imp(pb_ds::cc_hash_tag) m_native_c.clear(); break; case 1: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn()); + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn()); m_native_c.clear(); break; case 2: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn(), m_p_c->get_comb_hash_fn()); m_native_c.clear(); break; case 3: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn(), m_p_c->get_comb_hash_fn(), m_p_c->get_resize_policy()); m_native_c.clear(); break; case 4: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end()); break; case 5: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn()); break; case 6: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), m_p_c->get_eq_fn()); break; case 7: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_hash_fn()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), + m_p_c->get_eq_fn(), m_p_c->get_comb_hash_fn()); break; case 8: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_hash_fn(), + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), + m_p_c->get_eq_fn(), m_p_c->get_comb_hash_fn(), m_p_c->get_resize_policy()); break; default: - PB_DS_THROW_IF_FAILED( false, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(false, "", m_p_c, & m_native_c); }; - std::swap(p_c, m_p_c); } - catch(__gnu_cxx::forced_exception_error& ) + catch (__gnu_cxx::forced_exception_error&) { done = false; } delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } PB_DS_CLASS_T_DEC @@ -288,13 +232,9 @@ PB_DS_CLASS_C_DEC:: it_constructor_imp(pb_ds::gp_hash_tag) { bool done = true; - Cntnr* p_c = NULL; - m_alloc.set_throw_prob(m_tp); - - typename alloc_t::group_throw_prob_adjustor - adjust(m_p_c->size()); + typename alloc_t::group_throw_prob_adjustor adjust(m_p_c->size()); try { @@ -305,95 +245,68 @@ it_constructor_imp(pb_ds::gp_hash_tag) m_native_c.clear(); break; case 1: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn()); + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn()); m_native_c.clear(); break; case 2: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn(), m_p_c->get_comb_probe_fn()); m_native_c.clear(); break; case 3: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn(), m_p_c->get_comb_probe_fn()); m_native_c.clear(); break; case 4: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_probe_fn(), - m_p_c->get_probe_fn()); + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn(), + m_p_c->get_comb_probe_fn(), m_p_c->get_probe_fn()); m_native_c.clear(); break; case 5: - p_c = new Cntnr(m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_probe_fn(), - m_p_c->get_probe_fn(), + p_c = new Cntnr(m_p_c->get_hash_fn(), m_p_c->get_eq_fn(), + m_p_c->get_comb_probe_fn(), m_p_c->get_probe_fn(), m_p_c->get_resize_policy()); m_native_c.clear(); break; case 6: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn()); break; case 7: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), m_p_c->get_eq_fn()); break; case 8: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_probe_fn()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), + m_p_c->get_eq_fn(), m_p_c->get_comb_probe_fn()); break; case 9: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_probe_fn()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), + m_p_c->get_eq_fn(), m_p_c->get_comb_probe_fn()); break; case 10: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_probe_fn(), + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), + m_p_c->get_eq_fn(), m_p_c->get_comb_probe_fn(), m_p_c->get_probe_fn()); break; case 11: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_hash_fn(), - m_p_c->get_eq_fn(), - m_p_c->get_comb_probe_fn(), - m_p_c->get_probe_fn(), - m_p_c->get_resize_policy()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_hash_fn(), + m_p_c->get_eq_fn(), m_p_c->get_comb_probe_fn(), + m_p_c->get_probe_fn(), m_p_c->get_resize_policy()); break; default: - PB_DS_THROW_IF_FAILED( false, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(false, "", m_p_c, & m_native_c); }; - std::swap(p_c, m_p_c); } - catch(__gnu_cxx::forced_exception_error& ) + catch (__gnu_cxx::forced_exception_error&) { done = false; } delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } PB_DS_CLASS_T_DEC @@ -402,13 +315,9 @@ PB_DS_CLASS_C_DEC:: it_constructor_imp(pb_ds::tree_tag) { bool done = true; - Cntnr* p_c = NULL; - m_alloc.set_throw_prob(m_tp); - - typename alloc_t::group_throw_prob_adjustor - adjust(m_p_c->size()); + typename alloc_t::group_throw_prob_adjustor adjust(m_p_c->size()); try { @@ -419,26 +328,21 @@ it_constructor_imp(pb_ds::tree_tag) m_native_c.clear(); break; case 1: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), - m_p_c->get_cmp_fn()); + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_cmp_fn()); break; default: - PB_DS_THROW_IF_FAILED( false, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); }; - std::swap(p_c, m_p_c); } - catch(__gnu_cxx::forced_exception_error& ) + catch (__gnu_cxx::forced_exception_error&) { done = false; } delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } PB_DS_CLASS_T_DEC @@ -447,31 +351,23 @@ PB_DS_CLASS_C_DEC:: it_constructor_imp(pb_ds::list_update_tag) { bool done = true; - Cntnr* p_c = NULL; - m_alloc.set_throw_prob(m_tp); - - typename alloc_t::group_throw_prob_adjustor - adjust(m_p_c->size()); + typename alloc_t::group_throw_prob_adjustor adjust(m_p_c->size()); try { - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end()); - + p_c = new Cntnr(m_p_c->begin(), m_p_c->end()); std::swap(p_c, m_p_c); } - catch(__gnu_cxx::forced_exception_error& ) + catch (__gnu_cxx::forced_exception_error&) { done = false; } delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } PB_DS_CLASS_T_DEC @@ -480,13 +376,9 @@ PB_DS_CLASS_C_DEC:: it_constructor_imp(pb_ds::pat_trie_tag) { bool done = true; - Cntnr* p_c = NULL; - m_alloc.set_throw_prob(m_tp); - - typename alloc_t::group_throw_prob_adjustor - adjust(m_p_c->size()); + typename alloc_t::group_throw_prob_adjustor adjust(m_p_c->size()); try { @@ -497,25 +389,22 @@ it_constructor_imp(pb_ds::pat_trie_tag) m_native_c.clear(); break; case 1: - p_c = new Cntnr(m_p_c->begin(), - m_p_c->end(), + p_c = new Cntnr(m_p_c->begin(), m_p_c->end(), m_p_c->get_e_access_traits()); break; default: - PB_DS_THROW_IF_FAILED( false, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(false, "", m_p_c, & m_native_c); }; std::swap(p_c, m_p_c); } - catch(__gnu_cxx::forced_exception_error& ) + catch (__gnu_cxx::forced_exception_error&) { done = false; } delete p_c; - PB_DS_COND_COMPARE(*m_p_c, m_native_c); - - return (done); + return done; } diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp index 94e74ce1005..78fc38907b6 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp @@ -64,22 +64,22 @@ insert() if (ins_ret.second) { - PB_DS_THROW_IF_FAILED(!existed, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(!existed, "", m_p_c, &m_native_c); } else { - PB_DS_THROW_IF_FAILED(existed, "", m_p_c, & m_native_c); - PB_DS_THROW_IF_FAILED(found_it == ins_ret.first, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(existed, "", m_p_c, &m_native_c); + PB_DS_THROW_IF_FAILED(found_it == ins_ret.first, "", m_p_c, &m_native_c); } m_native_c.insert(test_traits::native_value(v)); } - catch(__gnu_cxx::forced_exception_error& ) + catch(__gnu_cxx::forced_exception_error&) { done = false; } - catch(pb_ds::insert_error& ) + catch(pb_ds::insert_error&) { - PB_DS_THROW_IF_FAILED(false, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); } PB_DS_COND_COMPARE(*m_p_c, m_native_c); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/operator_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/operator_fn_imps.hpp index e6298a818df..323376480d3 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/operator_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/operator_fn_imps.hpp @@ -41,7 +41,7 @@ /** * @file operator_fn_imps.hpp - * Containsert a random regression test for a specific container type. + * Contains a random regression test for a specific container type. */ PB_DS_CLASS_T_DEC @@ -49,14 +49,20 @@ void PB_DS_CLASS_C_DEC:: operator()() { - xml_result_set_regression_formatter* p_fmt = NULL; + typedef xml_result_set_regression_formatter formatter_type; + formatter_type* p_fmt = NULL; if (m_disp) - p_fmt = new xml_result_set_regression_formatter(string_form<Cntnr>::name(), - string_form<Cntnr>::desc()); + p_fmt = new formatter_type(string_form<Cntnr>::name(), + string_form<Cntnr>::desc()); m_g.init(m_seed); + + // Track allocation from this point only. + const size_t memory_label = 775; m_alloc.init(m_seed); + m_alloc.set_label(memory_label); + prog_bar pb(m_n, std::cout, m_disp); m_i = 0; @@ -65,10 +71,8 @@ operator()() for (m_i = 0; m_i < m_n; ++m_i) { PB_DS_TRACE("Op #" << static_cast<unsigned long>(m_i)); - allocator::set_label(m_i); - - switch(m_i) + switch (m_i) { case 0: PB_DS_RUN_MTHD(default_constructor); @@ -157,18 +161,18 @@ operator()() get_set_loads(); break; default: - PB_DS_THROW_IF_FAILED(false, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); } break; default: - PB_DS_THROW_IF_FAILED(false, "", m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); }; } pb.inc(); } } - catch(...) + catch (...) { std::cerr << "Failed at index " << static_cast<unsigned long>(m_i) << std::endl; @@ -176,15 +180,21 @@ operator()() throw; } + // Clean up, then check for allocation by special label, set above. delete m_p_c; - if (!m_alloc.throw_allocator<char>::empty()) + try + { m_alloc.check_allocated(memory_label); } + catch (...) { std::cerr << "detected leaks!" << std::endl; std::cerr << m_alloc << std::endl; PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); } + // Reset throw probability. + m_alloc.set_throw_prob(0); + if (m_disp) { std::cout << std::endl; @@ -200,17 +210,17 @@ get_next_op() const double prob = m_g.get_prob(); if (prob < m_ip) - return (insert_op); + return insert_op; if (prob < m_ip + m_ep) - return (erase_op); + return erase_op; if (prob < m_ip + m_ep + m_cp) - return (clear_op); + return clear_op; PB_DS_THROW_IF_FAILED(prob <= 1, prob, m_p_c, &m_native_c); - return (other_op); + return other_op; } PB_DS_CLASS_T_DEC @@ -222,15 +232,14 @@ get_next_sub_op(size_t max) const double delta = 1 / static_cast<double>(max); size_t i = 0; while (true) - if (p <= (i + 1)* delta) + if (p <= (i + 1) * delta) { PB_DS_THROW_IF_FAILED(i < max, static_cast<unsigned long>(i) << " " << static_cast<unsigned long>(max), - m_p_c, - & m_native_c); + m_p_c, &m_native_c); - return (i); + return i; } else ++i; diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp index 219701c46cf..2081c7c8b2d 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp @@ -76,7 +76,7 @@ namespace detail template<typename Cntnr> void - operator()(__gnu_cxx::typelist::detail::type_to_type<Cntnr>) + operator()(Cntnr) { unsigned long ul = static_cast<unsigned long>(m_sd); container_rand_regression_test<Cntnr> t(ul, m_n, m_n, m_tp, m_ip, @@ -145,12 +145,12 @@ namespace detail detail::rand_reg_test tst(sd, n, m, tp, ip, ep, cp, mp, disp); __gnu_cxx::typelist::apply(tst, tl); } - catch(...) + catch (...) { std::cerr << "Test failed with seed " << sd << std::endl; if (disp) delete p_fmt; - return -1; + throw; } if (disp) diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/operator_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/operator_fn_imps.hpp index 3041bda1a7f..7a34b812167 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/operator_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/operator_fn_imps.hpp @@ -49,14 +49,20 @@ void PB_DS_CLASS_C_DEC:: operator()() { - xml_result_set_regression_formatter* p_fmt = NULL; + typedef xml_result_set_regression_formatter formatter_type; + formatter_type* p_fmt = NULL; if (m_disp) - p_fmt = new xml_result_set_regression_formatter(string_form<Cntnr>::name(), - string_form<Cntnr>::desc()); + p_fmt = new formatter_type(string_form<Cntnr>::name(), + string_form<Cntnr>::desc()); m_g.init(m_seed); + + // Track allocation from this point only. + const size_t memory_label = 775; m_alloc.init(m_seed); + m_alloc.set_label(memory_label); + prog_bar pb(m_n, std::cout, m_disp); m_i = 0; @@ -140,22 +146,29 @@ operator()() pb.inc(); } } - catch(...) + catch (...) { std::cerr << "Failed at index " << static_cast<unsigned long>(m_i) << std::endl; delete m_p_c; throw; } + + // Clean up, then check for allocation by special label, set above. delete m_p_c; - if (!m_alloc.throw_allocator<char>::empty()) + try + { m_alloc.check_allocated(memory_label); } + catch (...) { std::cerr << "detected leaks!" << std::endl; std::cerr << m_alloc << std::endl; PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); } + // Reset throw probability. + m_alloc.set_throw_prob(0); + if (m_disp) { std::cout << std::endl; diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp index 1390a075b86..0d4c960fb85 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp @@ -76,7 +76,7 @@ namespace detail template<typename Cntnr> void - operator()(__gnu_cxx::typelist::detail::type_to_type<Cntnr>) + operator()(Cntnr) { unsigned long ul = static_cast<unsigned long>(m_sd); container_rand_regression_test<Cntnr> t(ul, m_n, m_n, m_tp, m_ip, m_dp, diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp index 16075f17e17..df8b66fcbc8 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp @@ -52,110 +52,70 @@ namespace pb_ds { - namespace test { - namespace detail { - template<typename Cntnr> struct regression_test_type_traits { - - public: - typedef Cntnr cntnr; - typedef typename cntnr::key_type key_type; - typedef typename cntnr::const_key_reference const_key_reference; - typedef typename cntnr::value_type value_type; - typedef typename cntnr::const_reference const_reference; - typedef typename cntnr::mapped_type mapped_type; - typedef typename cntnr::const_mapped_reference const_mapped_reference; - public: - template<typename Gen> static key_type generate_key(Gen& r_gen, size_t max) - { - return (basic_type(r_gen, max)); - } + { return basic_type(r_gen, max); } template<typename Gen> static value_type generate_value(Gen& r_gen, size_t max) - { - return (generate_value(r_gen, max, - __gnu_cxx::typelist::detail::type_to_type<value_type>())); - } + { return generate_value(r_gen, max, value_type()); } static const_key_reference extract_key(const_reference r_val) - { - return extract_key_imp(r_val); - } + { return extract_key_imp(r_val); } private: - typedef - typename Cntnr::allocator::template rebind< - basic_type>::other::const_reference - basic_type_const_reference; - - typedef - typename Cntnr::allocator::template rebind< - std::pair< - basic_type, - basic_type> >::other::const_reference - basic_type_pair_const_reference; + typedef typename cntnr::allocator::template rebind<basic_type>::other + basic_type_rebind; + + typedef typename basic_type_rebind::const_reference basic_type_const_reference; + + typedef typename cntnr::allocator::template rebind<std::pair<basic_type, basic_type> >::other pair_type_rebind; + typedef typename pair_type_rebind::const_reference pair_type_const_reference; - private: template<typename Gen> static value_type - generate_value(Gen& r_gen, size_t max, __gnu_cxx::typelist::detail::type_to_type<pb_ds::null_mapped_type>) - { - return (basic_type(r_gen, max)); - } + generate_value(Gen& r_gen, size_t max, pb_ds::null_mapped_type) + { return basic_type(r_gen, max); } template<typename Gen> static value_type - generate_value(Gen& r_gen, size_t max, __gnu_cxx::typelist::detail::type_to_type<basic_type>) - { - return (basic_type(r_gen, max)); - } + generate_value(Gen& r_gen, size_t max, basic_type) + { return basic_type(r_gen, max); } template<typename Gen> static value_type - generate_value(Gen& r_gen, size_t max, __gnu_cxx::typelist::detail::type_to_type<std::pair<const basic_type, basic_type> >) - { - return (std::make_pair(basic_type(r_gen, max), basic_type(r_gen, max))); - } + generate_value(Gen& gen, size_t max, + std::pair<const basic_type, basic_type>) + { return std::make_pair(basic_type(gen, max), basic_type(gen, max)); } static const_key_reference extract_key_imp(basic_type_const_reference r_val) - { - return r_val; - } + { return r_val; } static const_key_reference - extract_key_imp(basic_type_pair_const_reference r_val) - { - return r_val.first; - } + extract_key_imp(pair_type_const_reference r_val) + { return r_val.first; } }; - -#undef PB_DS_BASE_C_DEC - } // namespace detail - } // namespace test - } // namespace pb_ds -#endif // #ifndef PB_DS_REGRESSION_TEST_TYPE_TRAIT_HPP +#endif |