1 // { dg-require-debug-mode "" }
2 // { dg-require-time "" }
3 // This can take long on simulators, timing out the test.
4 // { dg-options "-DITERATIONS=5" { target simulator } }
5 // { dg-timeout-factor 2.0 }
9 // Copyright (C) 2011-2019 Free Software Foundation, Inc.
11 // This file is part of the GNU ISO C++ Library. This library is free
12 // software; you can redistribute it and/or modify it under the terms
13 // of the GNU General Public License as published by the Free Software
14 // Foundation; either version 3, or (at your option) any later
17 // This library is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // General Public License for more details.
22 // You should have received a copy of the GNU General Public License
23 // along with this library; see the file COPYING3. If not see
24 // <http://www.gnu.org/licenses/>.
27 * @file tree_data_map_rand_debug.cc
28 * Contains a random-operation test for maps and sets, separated out.
31 #define PB_DS_REGRESSION
32 //#define PB_DS_REGRESSION_TRACE
34 #include <regression/rand/assoc/rand_regression_test.hpp>
35 #include <regression/common_type.hpp>
36 #include <ext/throw_allocator.h>
37 #include <ext/pb_ds/tag_and_trait.hpp>
40 # define ITERATIONS 100
47 // Debug version of the rand regression tests, based on tree_data_map.
50 // Simplify things by unrolling the typelist of the different
51 // container types into individual statements.
53 // Unroll the typelist represented by tree_types, from
54 // regression/common_type.hpp. This is just a compile-time list of 6
55 // tree types, with different policies for the type of tree
56 // (ov_tree_tag, rb_tree_tag, splay_tree_tag) and for the node
57 // update (null_node_update, tree_order_statistics_node_update)
59 using namespace __gnu_pbds::test::detail
;
60 using namespace __gnu_pbds
;
61 typedef __gnu_pbds::test::basic_type basic_type
;
62 typedef __gnu_cxx::throw_allocator_random
<basic_type
> allocator_type
;
65 typedef tree
<basic_type
, basic_type
, std::less
<basic_type
>,
66 ov_tree_tag
, null_node_update
,
67 allocator_type
> ov_tree_type1
;
69 typedef tree
<basic_type
, basic_type
, std::less
<basic_type
>,
70 ov_tree_tag
, tree_order_statistics_node_update
,
71 allocator_type
> ov_tree_type2
;
74 typedef tree
<basic_type
, basic_type
, std::less
<basic_type
>,
75 rb_tree_tag
, null_node_update
,
76 allocator_type
> rb_tree_type1
;
78 typedef tree
<basic_type
, basic_type
, std::less
<basic_type
>,
79 rb_tree_tag
, tree_order_statistics_node_update
,
80 allocator_type
> rb_tree_type2
;
83 typedef tree
<basic_type
, basic_type
, std::less
<basic_type
>,
84 splay_tree_tag
, null_node_update
,
85 allocator_type
> splay_tree_type1
;
87 typedef tree
<basic_type
, basic_type
, std::less
<basic_type
>,
88 splay_tree_tag
, tree_order_statistics_node_update
,
89 allocator_type
> splay_tree_type2
;
93 // Specialize container_rand_regression_test for specific container
94 // type and test function.
97 // For testing one specific container type.
98 typedef ov_tree_type2 test_type
;
100 void debug_break_here() { }
102 namespace __gnu_pbds
{
108 container_rand_regression_test
<test_type
>::operator()()
120 // Set up the test object.
121 size_t sd
= 1303948889;
122 rand_reg_test
test(sd
, ITERATIONS
, KEYS
, 0.2, .6, .2, .001, .25, true);
125 // Determine the problem container, function that fails.
126 test(ov_tree_type1());
127 test(ov_tree_type2());
128 test(rb_tree_type1());
129 test(rb_tree_type2());
130 test(splay_tree_type1());
131 test(splay_tree_type2());
135 // With specified problem container set test_type typedef
136 // appropriately above. Then, specialize operator()(), also
137 // above. Finally, run this below.