Author: marshall
Date: Mon Jun 30 00:04:20 2014
New Revision: 212017

URL: http://llvm.org/viewvc/llvm-project?rev=212017&view=rev
Log:
Add checking for the complexity guarantees in the standard

Modified:
    
libcxx/trunk/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp

Modified: 
libcxx/trunk/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp?rev=212017&r1=212016&r2=212017&view=diff
==============================================================================
--- 
libcxx/trunk/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
 (original)
+++ 
libcxx/trunk/test/algorithms/alg.sorting/alg.heap.operations/make.heap/make_heap_comp.pass.cpp
 Mon Jun 30 00:04:20 2014
@@ -17,6 +17,9 @@
 #include <algorithm>
 #include <functional>
 #include <cassert>
+
+#include "counting_predicates.hpp"
+
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 #include <memory>
 
@@ -34,9 +37,20 @@ 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, std::greater<int>());
     assert(std::is_heap(ia, ia+N, std::greater<int>()));
+    }
+
+    {
+    binary_counting_predicate<std::greater<int>, int, int> pred 
((std::greater<int>()));
+    std::random_shuffle(ia, ia+N);
+    std::make_heap(ia, ia+N, std::ref(pred));
+    assert(pred.count() <= 3*N);
+    assert(std::is_heap(ia, ia+N, pred));   
+    }
+
     delete [] ia;
 }
 
@@ -48,6 +62,8 @@ int main()
     test(3);
     test(10);
     test(1000);
+    test(10000);
+    test(100000);
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     {


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to