diff options
Diffstat (limited to 'test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp')
-rw-r--r-- | test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp new file mode 100644 index 000000000000..51b912768f35 --- /dev/null +++ b/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap.pass.cpp @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// make_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); + std::make_heap(ia, ia+N); + assert(std::is_heap(ia, ia+N)); + delete [] ia; +} + +int main() +{ + test(0); + test(1); + test(2); + test(3); + test(10); + test(1000); +} |