Эх сурвалжийг харах

Fix some incorrect std::function tests

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@362861 91177308-0d34-0410-b5e6-96231b3b80d8
Eric Fiselier 6 жил өмнө
parent
commit
5db0997bf6

+ 4 - 2
test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_F.pass.cpp

@@ -64,7 +64,9 @@ void test_FreeFunction(AllocType& alloc)
     FuncType* target = &FreeFunction;
     FuncType* target = &FreeFunction;
     assert(globalMemCounter.checkOutstandingNewEq(0));
     assert(globalMemCounter.checkOutstandingNewEq(0));
     std::function<FuncType> f2(std::allocator_arg, alloc, target);
     std::function<FuncType> f2(std::allocator_arg, alloc, target);
-    assert(globalMemCounter.checkOutstandingNewEq(0));
+    // The allocator may not fit in the small object buffer, if we allocated
+    // check it was done via the allocator.
+    assert(globalMemCounter.checkOutstandingNewEq(test_alloc_base::alloc_count));
     assert(f2.template target<FuncType*>());
     assert(f2.template target<FuncType*>());
     assert(*f2.template target<FuncType*>() == target);
     assert(*f2.template target<FuncType*>() == target);
     assert(f2.template target<FuncType>() == 0);
     assert(f2.template target<FuncType>() == 0);
@@ -81,7 +83,7 @@ void test_MemFunClass(AllocType& alloc)
     TargetType target = &MemFunClass::foo;
     TargetType target = &MemFunClass::foo;
     assert(globalMemCounter.checkOutstandingNewEq(0));
     assert(globalMemCounter.checkOutstandingNewEq(0));
     std::function<FuncType> f2(std::allocator_arg, alloc, target);
     std::function<FuncType> f2(std::allocator_arg, alloc, target);
-    assert(globalMemCounter.checkOutstandingNewEq(0));
+    assert(globalMemCounter.checkOutstandingNewEq(test_alloc_base::alloc_count));
     assert(f2.template target<TargetType>());
     assert(f2.template target<TargetType>());
     assert(*f2.template target<TargetType>() == target);
     assert(*f2.template target<TargetType>() == target);
     assert(f2.template target<FuncType*>() == 0);
     assert(f2.template target<FuncType*>() == 0);