1 /*=============================================================================
2 Copyright (c) 2010 Tim Blechmann
4 Use, modification and distribution is subject to the Boost Software
5 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
9 #define BOOST_TEST_MAIN
10 #include <boost/test/unit_test.hpp>
14 #include <boost/heap/fibonacci_heap.hpp>
16 #include "common_heap_tests.hpp"
17 #include "stable_heap_tests.hpp"
18 #include "mutable_heap_tests.hpp"
19 #include "merge_heap_tests.hpp"
22 template <bool stable
, bool constant_time_size
>
23 void run_fibonacci_heap_test(void)
25 typedef boost::heap::fibonacci_heap
<int, boost::heap::stable
<stable
>,
26 boost::heap::compare
<std::less
<int> >,
27 boost::heap::allocator
<std::allocator
<int> >,
28 boost::heap::constant_time_size
<constant_time_size
>
31 BOOST_CONCEPT_ASSERT((boost::heap::MutablePriorityQueue
<pri_queue
>));
32 BOOST_CONCEPT_ASSERT((boost::heap::MergablePriorityQueue
<pri_queue
>));
34 run_common_heap_tests
<pri_queue
>();
35 run_iterator_heap_tests
<pri_queue
>();
36 run_copyable_heap_tests
<pri_queue
>();
37 run_moveable_heap_tests
<pri_queue
>();
39 run_merge_tests
<pri_queue
>();
41 run_mutable_heap_tests
<pri_queue
>();
42 run_ordered_iterator_tests
<pri_queue
>();
45 typedef boost::heap::fibonacci_heap
<q_tester
, boost::heap::stable
<stable
>,
46 boost::heap::constant_time_size
<constant_time_size
>
48 run_stable_heap_tests
<stable_pri_queue
>();
52 BOOST_AUTO_TEST_CASE( fibonacci_heap_test
)
54 run_fibonacci_heap_test
<true, false>();
55 run_fibonacci_heap_test
<true, true>();
57 run_fibonacci_heap_test
<false, false>();
58 run_fibonacci_heap_test
<false, true>();
60 RUN_EMPLACE_TEST(fibonacci_heap
);
63 BOOST_AUTO_TEST_CASE( fibonacci_heap_compare_lookup_test
)
65 typedef boost::heap::fibonacci_heap
<int,
66 boost::heap::compare
<less_with_T
>,
67 boost::heap::allocator
<std::allocator
<int> > > pri_queue
;
68 run_common_heap_tests
<pri_queue
>();
72 BOOST_AUTO_TEST_CASE( fibonacci_heap_leak_test
)
74 typedef boost::heap::fibonacci_heap
<boost::shared_ptr
<int> > pri_queue
;
75 run_leak_check_test
<pri_queue
>();