From aa73023bee1aebc745188e54039d3bf567be97e3 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic <steven.lerouzic@gmail.com> Date: Thu, 20 Feb 2025 23:47:02 +0100 Subject: Use intrusive list in logging, and add defer --- asl/containers/intrusive_list_tests.cpp | 60 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'asl/containers/intrusive_list_tests.cpp') diff --git a/asl/containers/intrusive_list_tests.cpp b/asl/containers/intrusive_list_tests.cpp index 242aaf6..ceb54a6 100644 --- a/asl/containers/intrusive_list_tests.cpp +++ b/asl/containers/intrusive_list_tests.cpp @@ -194,33 +194,33 @@ ASL_TEST(pop_front) ASL_TEST_ASSERT(list.is_empty()); } -// ASL_TEST(pop_back) -// { -// IntNode one{1}; -// IntNode two{2}; -// IntNode three{3}; -// asl::IntrusiveList<IntNode> list; - -// list.push_back(&one); -// list.push_back(&two); -// list.push_back(&three); - -// IntNode* n = list.pop_back(); -// ASL_TEST_ASSERT(n != nullptr); -// ASL_TEST_ASSERT(!list.is_empty()); -// ASL_TEST_EXPECT(n->value == 3); - -// n = list.pop_back(); -// ASL_TEST_ASSERT(n != nullptr); -// ASL_TEST_ASSERT(!list.is_empty()); -// ASL_TEST_EXPECT(n->value == 2); - -// n = list.pop_back(); -// ASL_TEST_ASSERT(n != nullptr); -// ASL_TEST_ASSERT(list.is_empty()); -// ASL_TEST_EXPECT(n->value == 1); - -// n = list.pop_back(); -// ASL_TEST_ASSERT(n == nullptr); -// ASL_TEST_ASSERT(list.is_empty()); -// } +ASL_TEST(pop_back) +{ + IntNode one{1}; + IntNode two{2}; + IntNode three{3}; + asl::IntrusiveList<IntNode> list; + + list.push_back(&one); + list.push_back(&two); + list.push_back(&three); + + IntNode* n = list.pop_back(); + ASL_TEST_ASSERT(n != nullptr); + ASL_TEST_ASSERT(!list.is_empty()); + ASL_TEST_EXPECT(n->value == 3); + + n = list.pop_back(); + ASL_TEST_ASSERT(n != nullptr); + ASL_TEST_ASSERT(!list.is_empty()); + ASL_TEST_EXPECT(n->value == 2); + + n = list.pop_back(); + ASL_TEST_ASSERT(n != nullptr); + ASL_TEST_ASSERT(list.is_empty()); + ASL_TEST_EXPECT(n->value == 1); + + n = list.pop_back(); + ASL_TEST_ASSERT(n == nullptr); + ASL_TEST_ASSERT(list.is_empty()); +} -- cgit