summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-07-12 23:18:32 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-07-14 13:04:41 +0200
commit2a597bdcfcb6fd685be121d7f52693832c122589 (patch)
treec142767cd96672eba3891ac34be4ee065ec60640 /test
parent19abcac32009d58450d80add39c5b1d5e7d8a993 (diff)
w
Diffstat (limited to 'test')
-rw-r--r--test/handle.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/handle.cpp b/test/handle.cpp
index 2198281c..cbec8cac 100644
--- a/test/handle.cpp
+++ b/test/handle.cpp
@@ -32,9 +32,19 @@ namespace {
void test_page1()
{
Page page{start_index};
- auto& item = page.allocate();
- fm_assert(item.handle == Handle{start_index});
- page.deallocate(item.handle);
+ auto& item0 = page.allocate();
+ auto handle0 = item0.handle;
+ fm_assert(item0.handle == Handle{start_index});
+ page.deallocate(item0.handle);
+
+ auto& item1 = page.allocate();
+ auto& item2 = page.allocate();
+ fm_assert(item1.handle.index == start_index || item2.handle.index == start_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);
}
} // namespace