• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2010 Tim Blechmann
3 
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 =============================================================================*/
8 
9 #define BOOST_TEST_MAIN
10 #include <boost/test/unit_test.hpp>
11 
12 #include <algorithm>
13 
14 #include <boost/heap/priority_queue.hpp>
15 
16 #include "common_heap_tests.hpp"
17 #include "stable_heap_tests.hpp"
18 #include "merge_heap_tests.hpp"
19 
20 template <bool stable>
run_common_priority_queue_tests(void)21 void run_common_priority_queue_tests(void)
22 {
23     typedef boost::heap::priority_queue<int, boost::heap::stable<stable> > pri_queue;
24     BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<pri_queue>));
25 
26     run_concept_check<pri_queue>();
27     run_common_heap_tests<pri_queue>();
28     run_iterator_heap_tests<pri_queue>();
29     run_copyable_heap_tests<pri_queue>();
30     run_moveable_heap_tests<pri_queue>();
31     run_merge_tests<pri_queue>();
32 
33     if (stable) {
34         typedef boost::heap::priority_queue<q_tester, boost::heap::stable<stable> > stable_pri_queue;
35         run_stable_heap_tests<stable_pri_queue>();
36     }
37 }
38 
BOOST_AUTO_TEST_CASE(std_pri_queue_test)39 BOOST_AUTO_TEST_CASE( std_pri_queue_test )
40 {
41     run_common_priority_queue_tests<false>();
42     run_common_priority_queue_tests<true>();
43 }
44 
BOOST_AUTO_TEST_CASE(std_pri_queue_leak_test)45 BOOST_AUTO_TEST_CASE( std_pri_queue_leak_test )
46 {
47     typedef boost::heap::priority_queue<boost::shared_ptr<int> > pri_queue;
48     run_leak_check_test<pri_queue>();
49 }
50