From 561eec3d8d1de4491f601720e7029352a081b31c Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Fri, 21 Aug 2026 15:44:01 -0700 Subject: [PATCH 1/2] Use allocated value for deallocate test --- test/resource.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/resource.cpp b/test/resource.cpp index b4ab0904..7e3c7327 100644 --- a/test/resource.cpp +++ b/test/resource.cpp @@ -274,6 +274,8 @@ TEST(CampResource, EmptyBehavior) Resource full{Host()}; Resource sink{std::move(full)}; int value = 7; + Host host; + int* allocated_value = host.allocate(1); CAMP_ALLOW_UNUSED_LOCAL(sink); @@ -294,7 +296,7 @@ TEST(CampResource, EmptyBehavior) ASSERT_FALSE(empty.try_get()); ASSERT_THROW((void)empty.allocate(1), std::runtime_error); ASSERT_THROW((void)empty.calloc(1), std::runtime_error); - ASSERT_THROW(empty.deallocate(&value), std::runtime_error); + ASSERT_THROW(empty.deallocate(&allocated_value), std::runtime_error); ASSERT_THROW(empty.memcpy(&value, &value, 1), std::runtime_error); ASSERT_THROW(empty.memset(&value, 0, 1), std::runtime_error); @@ -307,6 +309,8 @@ TEST(CampResource, EmptyBehavior) Event host_event = Host().get_event_erased(); empty.wait_for(empty_event); empty.wait_for(host_event); + + host.deallocate(allocated_value); } TEST(CampEvent, EmptyBehavior) From 507b342501e1506d150368a43b0825297d75afb4 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Fri, 21 Aug 2026 16:01:00 -0700 Subject: [PATCH 2/2] Typo --- test/resource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/resource.cpp b/test/resource.cpp index 7e3c7327..47724c9f 100644 --- a/test/resource.cpp +++ b/test/resource.cpp @@ -296,7 +296,7 @@ TEST(CampResource, EmptyBehavior) ASSERT_FALSE(empty.try_get()); ASSERT_THROW((void)empty.allocate(1), std::runtime_error); ASSERT_THROW((void)empty.calloc(1), std::runtime_error); - ASSERT_THROW(empty.deallocate(&allocated_value), std::runtime_error); + ASSERT_THROW(empty.deallocate(allocated_value), std::runtime_error); ASSERT_THROW(empty.memcpy(&value, &value, 1), std::runtime_error); ASSERT_THROW(empty.memset(&value, 0, 1), std::runtime_error);