blob: d1a4844f0ad9022755a6378b4a19de55ab5ab552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
/*=============================================================================
Copyright (c) 2010 Tim Blechmann
Use, modification and distribution is subject to 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)
=============================================================================*/
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/heap/d_ary_heap.hpp>
#include <boost/heap/fibonacci_heap.hpp>
#include <boost/heap/pairing_heap.hpp>
#include <boost/heap/binomial_heap.hpp>
#include <boost/heap/skew_heap.hpp>
using namespace boost::heap;
typedef fibonacci_heap<struct fwd_declared_struct_1>::handle_type handle_type_1;
typedef d_ary_heap<struct fwd_declared_struct_2, arity<4>, mutable_<true> >::handle_type handle_type_2;
typedef pairing_heap<struct fwd_declared_struct_3>::handle_type handle_type_3;
typedef binomial_heap<struct fwd_declared_struct_4>::handle_type handle_type_4;
typedef skew_heap<struct fwd_declared_struct_5, mutable_<true> >::handle_type handle_type_5;
template <typename HeapType>
void run_handle_as_member_test(void)
{
typedef typename HeapType::value_type value_type;
HeapType heap;
value_type f(2);
typename value_type::handle_type handle = heap.push(f);
value_type & fInHeap = *handle;
fInHeap.handle = handle;
}
struct fibonacci_heap_data
{
typedef fibonacci_heap<fibonacci_heap_data>::handle_type handle_type;
handle_type handle;
int i;
fibonacci_heap_data(int i):i(i) {}
bool operator<(fibonacci_heap_data const & rhs) const
{
return i < rhs.i;
}
};
BOOST_AUTO_TEST_CASE( fibonacci_heap_handle_as_member )
{
run_handle_as_member_test<fibonacci_heap<fibonacci_heap_data> >();
}
struct d_heap_data
{
typedef d_ary_heap<d_heap_data, arity<4>, mutable_<true> >::handle_type handle_type;
handle_type handle;
int i;
d_heap_data(int i):i(i) {}
bool operator<(d_heap_data const & rhs) const
{
return i < rhs.i;
}
};
BOOST_AUTO_TEST_CASE( d_heap_handle_as_member )
{
run_handle_as_member_test<d_ary_heap<d_heap_data, arity<4>, mutable_<true> > >();
}
struct pairing_heap_data
{
typedef pairing_heap<pairing_heap_data>::handle_type handle_type;
handle_type handle;
int i;
pairing_heap_data(int i):i(i) {}
bool operator<(pairing_heap_data const & rhs) const
{
return i < rhs.i;
}
};
BOOST_AUTO_TEST_CASE( pairing_heap_handle_as_member )
{
run_handle_as_member_test<pairing_heap<pairing_heap_data> >();
}
struct binomial_heap_data
{
typedef binomial_heap<binomial_heap_data>::handle_type handle_type;
handle_type handle;
int i;
binomial_heap_data(int i):i(i) {}
bool operator<(binomial_heap_data const & rhs) const
{
return i < rhs.i;
}
};
BOOST_AUTO_TEST_CASE( binomial_heap_handle_as_member )
{
run_handle_as_member_test<binomial_heap<binomial_heap_data> >();
}
struct skew_heap_data
{
typedef skew_heap<skew_heap_data, mutable_<true> >::handle_type handle_type;
handle_type handle;
int i;
skew_heap_data(int i):i(i) {}
bool operator<(skew_heap_data const & rhs) const
{
return i < rhs.i;
}
};
BOOST_AUTO_TEST_CASE( skew_heap_handle_as_member )
{
run_handle_as_member_test<skew_heap<skew_heap_data, mutable_<true> > >();
}
|