Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
82541fb8
Commit
82541fb8
authored
Feb 06, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update monotonic_buffer_resource unit tests
parent
b99e3e9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
+3
-11
libcaf_core/test/detail/monotonic_buffer_resource.cpp
libcaf_core/test/detail/monotonic_buffer_resource.cpp
+3
-11
No files found.
libcaf_core/test/detail/monotonic_buffer_resource.cpp
View file @
82541fb8
...
@@ -60,7 +60,7 @@ SCENARIO("monotonic buffers group allocations") {
...
@@ -60,7 +60,7 @@ SCENARIO("monotonic buffers group allocations") {
}
}
}
}
SCENARIO
(
"monotonic buffers re-use
memory
after calling reclaim"
)
{
SCENARIO
(
"monotonic buffers re-use
small memory blocks
after calling reclaim"
)
{
std
::
vector
<
void
*>
locations
;
std
::
vector
<
void
*>
locations
;
GIVEN
(
"a monotonic buffer resource with some allocations performed on it"
)
{
GIVEN
(
"a monotonic buffer resource with some allocations performed on it"
)
{
detail
::
monotonic_buffer_resource
mbr
;
detail
::
monotonic_buffer_resource
mbr
;
...
@@ -68,23 +68,15 @@ SCENARIO("monotonic buffers re-use memory after calling reclaim") {
...
@@ -68,23 +68,15 @@ SCENARIO("monotonic buffers re-use memory after calling reclaim") {
locations
.
push_back
(
mbr
.
allocate
(
64
));
locations
.
push_back
(
mbr
.
allocate
(
64
));
locations
.
push_back
(
mbr
.
allocate
(
65
));
locations
.
push_back
(
mbr
.
allocate
(
65
));
locations
.
push_back
(
mbr
.
allocate
(
512
));
locations
.
push_back
(
mbr
.
allocate
(
512
));
locations
.
push_back
(
mbr
.
allocate
(
513
));
locations
.
push_back
(
mbr
.
allocate
(
1023
));
locations
.
push_back
(
mbr
.
allocate
(
1'048'577
));
locations
.
push_back
(
mbr
.
allocate
(
1'048'577
));
WHEN
(
"calling reclaim on the resource"
)
{
WHEN
(
"calling reclaim on the resource"
)
{
mbr
.
reclaim
();
mbr
.
reclaim
();
THEN
(
"performing the same allocations returns the same addresses again"
)
{
THEN
(
"performing the same allocations returns the same addresses again"
)
{
if
(
CHECK_EQ
(
mbr
.
blocks
(),
5
u
))
{
if
(
CHECK_EQ
(
mbr
.
blocks
(),
2
u
))
{
CHECK_EQ
(
locations
[
0
],
mbr
.
allocate
(
64
));
CHECK_EQ
(
locations
[
0
],
mbr
.
allocate
(
64
));
CHECK_EQ
(
locations
[
1
],
mbr
.
allocate
(
64
));
CHECK_EQ
(
locations
[
1
],
mbr
.
allocate
(
64
));
CHECK_EQ
(
locations
[
2
],
mbr
.
allocate
(
65
));
CHECK_EQ
(
locations
[
2
],
mbr
.
allocate
(
65
));
CHECK_EQ
(
locations
[
3
],
mbr
.
allocate
(
512
));
CHECK_EQ
(
locations
[
3
],
mbr
.
allocate
(
512
));
CHECK_EQ
(
locations
[
4
],
mbr
.
allocate
(
513
));
CHECK_EQ
(
mbr
.
blocks
(),
2u
);
CHECK_EQ
(
locations
[
5
],
mbr
.
allocate
(
1023
));
CHECK_EQ
(
locations
[
6
],
mbr
.
allocate
(
1'048'577
));
CHECK_EQ
(
locations
[
7
],
mbr
.
allocate
(
1'048'577
));
CHECK_EQ
(
mbr
.
blocks
(),
5u
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment