summaryrefslogtreecommitdiff
path: root/tests/test_astobj2_weaken.c
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-04-29 13:37:20 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-04-29 13:37:20 -0500
commit57cbb4bc8dda4cf4939f029e60290e3335a82c05 (patch)
tree71aeb2887fba33c4a1720edcff6630ec47e1803f /tests/test_astobj2_weaken.c
parent648b22f19d5223a87ae03a16286b2d94bd29b3fb (diff)
parentc9c03998cc9c57acbf1998a0cbc0bc1fa6d24edb (diff)
Merge "Astobj2: Add ao2_weakproxy_ref_object function."
Diffstat (limited to 'tests/test_astobj2_weaken.c')
-rw-r--r--tests/test_astobj2_weaken.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_astobj2_weaken.c b/tests/test_astobj2_weaken.c
index e53ab7a00..6a5eaeb99 100644
--- a/tests/test_astobj2_weaken.c
+++ b/tests/test_astobj2_weaken.c
@@ -223,7 +223,29 @@ AST_TEST_DEFINE(astobj2_weak1)
goto fail_cleanup;
}
+ if (ao2_t_weakproxy_ref_object(obj3, +1, 0, "ao2_ref should never see this") != -2) {
+ ast_test_status_update(test,
+ "Expected -2 from ao2_t_weakproxy_ref_object against normal ao2 object.\n");
+ goto fail_cleanup;
+ }
+
+ if (ao2_t_weakproxy_ref_object(weakref2, +1, 0, "weakref2 ref_object") != 2) {
+ ast_test_status_update(test, "Expected 2 from weakref2 ref_object.\n");
+ goto fail_cleanup;
+ }
+
+ if (ao2_t_ref(obj3, -1, "balance weakref2 ref_object") != 3) {
+ ast_test_status_update(test, "Expected 3 from obj3 ao2_t_ref.\n");
+ goto fail_cleanup;
+ }
+
ao2_ref(obj3, -1);
+
+ if (ao2_weakproxy_ref_object(weakref2, +1, 0) != -1) {
+ ast_test_status_update(test, "Expected -1 from weakref2 ref_object because obj3 is gone.\n");
+ goto fail_cleanup;
+ }
+
ao2_t_ref(weakref2, -1, "weakref2");
if (!weakproxydestroyed) {