1 // { dg-require-debug-mode "" }
2 // { dg-require-time "" }
3 // { dg-timeout-factor 2.0 }
7 // Copyright (C) 2011-2017 Free Software Foundation, Inc.
9 // This file is part of the GNU ISO C++ Library. This library is free
10 // software; you can redistribute it and/or modify it under the terms
11 // of the GNU General Public License as published by the Free Software
12 // Foundation; either version 3, or (at your option) any later
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // General Public License for more details.
20 // You should have received a copy of the GNU General Public License
21 // along with this library; see the file COPYING3. If not see
22 // <http://www.gnu.org/licenses/>.
25 * @file list_update_data_map_rand_debug.cc
26 * Contains a random-operation test for maps and sets, separated out.
29 #define PB_DS_REGRESSION
30 //#define PB_DS_REGRESSION_TRACE
32 #include <regression/rand/assoc/rand_regression_test.hpp>
33 #include <regression/common_type.hpp>
34 #include <ext/throw_allocator.h>
35 #include <ext/pb_ds/tag_and_trait.hpp>
37 // Debug version of the rand regression tests, based on list_update_data_map.
40 // Simplify things by unrolling the typelist of the different
41 // container types into individual statements.
43 // Unroll the typelist represented by list_update_types, from
44 // regression/common_type.hpp. This is just a compile-time list of
45 // list_update types, with different policies for the type of
46 // update (lu_move_to_front_policy, lu_counter_policy).
48 using namespace __gnu_pbds::test::detail
;
49 using namespace __gnu_pbds
;
50 typedef __gnu_pbds::test::basic_type basic_type
;
51 typedef __gnu_cxx::throw_allocator_random
<basic_type
> allocator_type
;
52 typedef std::equal_to
<basic_type
> equal_type
;
54 typedef __gnu_pbds::test::lu_move_to_front_policy_t_ policy_type1
;
56 typedef __gnu_pbds::test::lu_counter_policy_t_
<allocator_type
, 5u>
60 typedef list_update
<basic_type
, null_type
, equal_type
, policy_type1
,
64 typedef list_update
<basic_type
, null_type
, equal_type
, policy_type2
,
69 // Specialize container_rand_regression_test for specific container
70 // type and test function.
73 // For testing one specific container type.
74 typedef list_type1 test_type
;
76 void debug_break_here() { }
78 namespace __gnu_pbds
{
84 container_rand_regression_test
<test_type
>::operator()()
96 // Set up the test object.
97 size_t sd
= 1303948889;
98 rand_reg_test
test(sd
, 50, 10, .2, .6, .2, .001, .25, true);
101 // Determine the problem container, function that fails.
107 // With specified problem container set test_type typedef
108 // appropriately above. Then, specialize operator()(), also
109 // above. Finally, run this below.