[libcxx-commits] [PATCH] D98006: Fixed test

kamlesh kumar via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 5 01:06:53 PST 2021


kamleshbhalui updated this revision to Diff 328428.
kamleshbhalui added a comment.

Fixed more tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98006/new/

https://reviews.llvm.org/D98006

Files:
  libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp


Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -37,21 +37,19 @@
 
 int main(int, char**)
 {
-    globalMemCounter.reset();
-    A* ptr = new A;
-    globalMemCounter.throw_after = 0;
-    try
-    {
-        std::shared_ptr<A> p(ptr, test_deleter<A>(3));
-        assert(false);
-    }
-    catch (std::bad_alloc&)
-    {
-        assert(A::count == 0);
-        assert(test_deleter<A>::count == 0);
-        assert(test_deleter<A>::dealloc_count == 1);
-    }
-    assert(globalMemCounter.checkOutstandingNewEq(0));
-
+#if !defined(DISABLE_NEW_COUNT)
+  globalMemCounter.reset();
+  A* ptr = new A;
+  globalMemCounter.throw_after = 0;
+  try {
+    std::shared_ptr<A> p(ptr, test_deleter<A>(3));
+    assert(false);
+  } catch (std::bad_alloc&) {
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+  }
+  assert(globalMemCounter.checkOutstandingNewEq(0));
+#endif
   return 0;
 }
Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
+++ libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
@@ -39,18 +39,16 @@
 
 int main(int, char**)
 {
-    globalMemCounter.throw_after = 0;
-    try
-    {
-        std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
-        assert(false);
-    }
-    catch (std::bad_alloc&)
-    {
-        assert(A::count == 0);
-        assert(test_deleter<A>::count == 0);
-        assert(test_deleter<A>::dealloc_count == 1);
-    }
-
+#if !defined(DISABLE_NEW_COUNT)
+  globalMemCounter.throw_after = 0;
+  try {
+    std::shared_ptr<A> p(nullptr, test_deleter<A>(3));
+    assert(false);
+  } catch (std::bad_alloc&) {
+    assert(A::count == 0);
+    assert(test_deleter<A>::count == 0);
+    assert(test_deleter<A>::dealloc_count == 1);
+  }
+#endif
   return 0;
 }
Index: libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
===================================================================
--- libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
+++ libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
@@ -28,7 +28,7 @@
     typename List::iterator i = l1.insert(next(l1.cbegin()), 5, 4);
     assert(i == next(l1.begin()));
     assert(l1 == List(a2, a2+8));
-#ifndef TEST_HAS_NO_EXCEPTIONS
+#if !defined(TEST_HAS_NO_EXCEPTIONS) && !defined(DISABLE_NEW_COUNT)
     globalMemCounter.throw_after = 4;
     int save_count = globalMemCounter.outstanding_new;
     try


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98006.328428.patch
Type: text/x-patch
Size: 3255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210305/8ef31dd6/attachment.bin>


More information about the libcxx-commits mailing list