summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-07-14 17:01:46 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-07-14 17:17:45 +0200
commit25057f99ac871684695175738f9ac31890bb4bba (patch)
treefc482b9077032ae8ae2c973a0085dc2824c9a3c3 /test
parentb47f6164b82c166afb6d560caa3ffb79db15c7b7 (diff)
w
Diffstat (limited to 'test')
-rw-r--r--test/bptr.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/bptr.cpp b/test/bptr.cpp
index ffff5b19..e9d0dff3 100644
--- a/test/bptr.cpp
+++ b/test/bptr.cpp
@@ -1,6 +1,5 @@
#include "app.hpp"
#include "compat/borrowed-ptr.inl"
-#include "compat/borrowed-ptr-cast.hpp"
#include "compat/assert.hpp"
#include "compat/defs.hpp"
#include <array>
@@ -376,6 +375,19 @@ void test11()
auto p3 = static_pointer_cast<bptr_base>(p1);
fm_assert(p2->x == 1);
fm_assert(p3);
+ p1.destroy();
+ fm_assert(!p2); fm_assert(!p3);
+}
+
+void test12()
+{
+ auto p1 = bptr<bptr_base>{new Foo{1}};
+ {
+ fm_assert(p1.use_count() == 1);
+ auto p2 = static_pointer_cast<Foo>(p1);
+ fm_assert(p1.use_count() == 2);
+ }
+ fm_assert(p1.use_count() == 1);
}
} // namespace
@@ -393,6 +405,7 @@ void Test::test_bptr()
test9();
test10();
test11();
+ test12();
}
} // namespace floormat