File: fibonacci_heap_test.cpp

package info (click to toggle)
boost1.90 1.90.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 593,156 kB
  • sloc: cpp: 4,190,642; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,776; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (84 lines) | stat: -rw-r--r-- 3,145 bytes parent folder | download | duplicates (4)
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
/*=============================================================================
    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/fibonacci_heap.hpp>

#include "common_heap_tests.hpp"
#include "merge_heap_tests.hpp"
#include "mutable_heap_tests.hpp"
#include "stable_heap_tests.hpp"

template < bool stable, bool constant_time_size >
void run_fibonacci_heap_test( void )
{
    typedef boost::heap::fibonacci_heap< int,
                                         boost::heap::stable< stable >,
                                         boost::heap::compare< std::less< int > >,
                                         boost::heap::allocator< std::allocator< int > >,
                                         boost::heap::constant_time_size< constant_time_size > >
        pri_queue;

    BOOST_CONCEPT_ASSERT( (boost::heap::MutablePriorityQueue< pri_queue >));
    BOOST_CONCEPT_ASSERT( (boost::heap::MergablePriorityQueue< pri_queue >));

    run_common_heap_tests< pri_queue >();
    run_iterator_heap_tests< pri_queue >();
    run_copyable_heap_tests< pri_queue >();
    run_moveable_heap_tests< pri_queue >();

    run_merge_tests< pri_queue >();

    run_mutable_heap_tests< pri_queue >();
    run_ordered_iterator_tests< pri_queue >();

    if ( stable ) {
        typedef boost::heap::fibonacci_heap< q_tester,
                                             boost::heap::stable< stable >,
                                             boost::heap::constant_time_size< constant_time_size > >
            stable_pri_queue;
        run_stable_heap_tests< stable_pri_queue >();
    }

    typedef boost::heap::fibonacci_heap< int,
                                         boost::heap::stable< stable >,
                                         boost::heap::compare< std::less< int > >,
                                         boost::heap::allocator< boost::container::pmr::polymorphic_allocator< int > >,
                                         boost::heap::constant_time_size< constant_time_size > >
        pmr_pri_queue;

    pri_queue_test_stateful_allocator< pmr_pri_queue >();
}

BOOST_AUTO_TEST_CASE( fibonacci_heap_test )
{
    run_fibonacci_heap_test< true, false >();
    run_fibonacci_heap_test< true, true >();

    run_fibonacci_heap_test< false, false >();
    run_fibonacci_heap_test< false, true >();

    RUN_EMPLACE_TEST( fibonacci_heap );
}

BOOST_AUTO_TEST_CASE( fibonacci_heap_compare_lookup_test )
{
    typedef boost::heap::
        fibonacci_heap< int, boost::heap::compare< less_with_T >, boost::heap::allocator< std::allocator< int > > >
            pri_queue;
    run_common_heap_tests< pri_queue >();
}


BOOST_AUTO_TEST_CASE( fibonacci_heap_leak_test )
{
    typedef boost::heap::fibonacci_heap< boost::shared_ptr< int > > pri_queue;
    run_leak_check_test< pri_queue >();
}