OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [ext/] [pb_ds/] [regression/] [trie_map_rand_debug.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { 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 }
6
 
7
// -*- C++ -*-
8
 
9
// Copyright (C) 2011 Free Software Foundation, Inc.
10
//
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
15
// version.
16
 
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.
21
 
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/>.
25
 
26
/**
27
 * @file trie_data_map_rand_debug.cc
28
 * Contains a random-operation test for maps and sets, separated out.
29
 */
30
 
31
#define PB_DS_REGRESSION
32
//#define PB_DS_REGRESSION_TRACE
33
 
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>
38
 
39
#ifndef ITERATIONS
40
# define ITERATIONS 100
41
#endif
42
 
43
#ifndef KEYS
44
# define KEYS 200
45
#endif
46
 
47
// Debug version of the rand regression tests, based on trie_no_data_map.
48
 
49
// 1
50
// Simplify things by unrolling the typelist of the different
51
// container types into individual statements.
52
//
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
// (pat_trie_tag) and for the node
57
// update (null_node_update, trie_order_statistics_node_update,
58
// trie_order_staticstics_node_update, trie_prefix_search_node_update)
59
 
60
using namespace __gnu_pbds::test::detail;
61
using namespace __gnu_pbds;
62
typedef __gnu_pbds::test::basic_type                    basic_type;
63
typedef __gnu_cxx::throw_allocator_random<basic_type>   allocator_type;
64
typedef __gnu_pbds::trie_string_access_traits<basic_type, char('a'), 100,
65
                                                false, allocator_type>
66
                                                        etraits_type;
67
 
68
// pat_trie_tag
69
typedef trie<basic_type, basic_type, etraits_type, pat_trie_tag,
70
             null_node_update, allocator_type>
71
                                                        trie_type1;
72
 
73
typedef trie<basic_type, basic_type, etraits_type, pat_trie_tag,
74
             trie_order_statistics_node_update, allocator_type>
75
                                                        trie_type2;
76
 
77
typedef trie<basic_type, basic_type, etraits_type, pat_trie_tag,
78
             trie_prefix_search_node_update, allocator_type>
79
                                                        trie_type3;
80
 
81
 
82
// 2
83
// Specialize container_rand_regression_test for specific container
84
// type and test function.
85
 
86
#ifdef SPECIALIZE
87
// For testing one specific container type.
88
typedef trie_type1                                      test_type;
89
 
90
void debug_break_here() { }
91
 
92
namespace __gnu_pbds {
93
  namespace test {
94
    namespace detail {
95
 
96
      template<>
97
      void
98
      container_rand_regression_test<test_type>::operator()()
99
      {
100
 
101
      }
102
    }
103
  }
104
}
105
#endif
106
 
107
int
108
main()
109
{
110
  // Set up the test object.
111
  size_t sd = 1303948889;
112
  rand_reg_test test(sd, ITERATIONS, KEYS, 0.2, .6, .2, .001, .25, true);
113
 
114
  // 1
115
  // Determine the problem container, function that fails.
116
  test(trie_type1());
117
  test(trie_type2());
118
  test(trie_type3());
119
 
120
#ifdef SPECIALIZE
121
  // 2
122
  // With specified problem container set test_type typedef
123
  // appropriately above. Then, specialize operator()(), also
124
  // above. Finally, run this below.
125
  using namespace std;
126
  test_type obj;
127
  test(obj);
128
#endif
129
 
130
  return 0;
131
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.