Пример #1
0
void fill_heap(pri_queue & q, int index, int size, int offset = 0)
{
    test_data const & data = get_data(index);

    for (int i = 0; i != size + 1; ++i) {
        q.push(data[i]);
        int top = q.top();
        q.pop();
        q.push(top);
    }
}
Пример #2
0
void check_q(pri_queue & q, data_container const & expected)
{
    BOOST_REQUIRE_EQUAL(q.size(), expected.size());

    for (unsigned int i = 0; i != expected.size(); ++i)
    {
        BOOST_REQUIRE_EQUAL(q.size(), expected.size() - i);
        BOOST_REQUIRE_EQUAL(q.top(), expected[expected.size()-1-i]);
        q.pop();
    }

    BOOST_REQUIRE(q.empty());
}