blob: 0fc50a81207e1f0abc295d30268115f873940c1f [file] [log] [blame]
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <algorithm>
// template<RandomAccessIterator Iter>
// requires ShuffleIterator<Iter>
// && LessThanComparable<Iter::value_type>
// void
// push_heap(Iter first, Iter last);
#include <algorithm>
#include <cassert>
void test(unsigned N)
{
int* ia = new int [N];
for (int i = 0; i < N; ++i)
ia[i] = i;
std::random_shuffle(ia, ia+N);
for (int i = 0; i <= N; ++i)
{
std::push_heap(ia, ia+i);
assert(std::is_heap(ia, ia+i));
}
delete [] ia;
}
int main()
{
test(1000);
}