From 3eb7e8d5a8b75a645d9994152451ce213e164887 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 14 Jul 2024 09:43:59 +0200 Subject: zz --- test/handle.cpp | 74 --------------------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 test/handle.cpp (limited to 'test') diff --git a/test/handle.cpp b/test/handle.cpp deleted file mode 100644 index 2c29f52c..00000000 --- a/test/handle.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "app.hpp" -//#include "src/handle.inl" -#include "src/handle.hpp" -#include "src/handle-page.inl" -//#include "src/handle-pool.inl" - -namespace floormat { -namespace { - -constexpr uint32_t start_index = 1024, page_size = 256; - -struct Foo -{ - int value = 0; - ~Foo() { value = 0; } -}; - -using Page = impl_handle::Page; -using Handle = impl_handle::Handle; - -} // namespace -} // namespace floormat - -namespace floormat::impl_handle { - -template struct Handle; -template struct Item; // NOLINT(*-pro-type-member-init) -template class Page; -//template class Pool; - -} // namespace floormat::impl_handle - - -namespace floormat::Test { - -namespace { - -void test_page1() -{ - Page page{start_index}; - auto& item0 = page.allocate(1); - fm_assert(page.use_count() == 1); - auto handle0 = item0.handle; - fm_assert(item0.handle == Handle{start_index, 0}); - fm_assert(item0.object.value == 1); - page.deallocate(item0.handle); - fm_assert(page.use_count() == 0); - - auto& item1 = page.allocate(2); - fm_assert(page.use_count() == 1); - auto& item2 = page.allocate(3); - fm_assert(page.use_count() == 2); - fm_assert(item1.object.value == 2); - fm_assert(item2.object.value == 3); - fm_assert(item1.handle.index == item0.handle.index || item2.handle.index == item0.handle.index); - fm_assert(item1.handle.index != item2.handle.index); - fm_assert(item1.handle.counter != item2.handle.counter); - fm_assert(int{item1.handle.counter != handle0.counter} + int{item2.handle.counter != handle0.counter} == 1); - page.deallocate(item2.handle); - page.deallocate(item1.handle); - fm_assert(item0.object.value == 0); - fm_assert(item1.object.value == 0); - fm_assert(item2.object.value == 0); - fm_assert(page.use_count() == 0); -} -} // namespace - - -void test_handle() -{ - test_page1(); -} - -} // namespace floormat::Test -- cgit v1.2.3