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
65332322
Commit
65332322
authored
Jan 04, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More exhausting testing in actor_lifetime
parent
05389c6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
unit_testing/test_actor_lifetime.cpp
unit_testing/test_actor_lifetime.cpp
+20
-6
No files found.
unit_testing/test_actor_lifetime.cpp
View file @
65332322
...
...
@@ -35,7 +35,6 @@ dude::~dude() {
--
s_dudes
;
}
behavior
linking_dude
(
event_based_actor
*
self
,
const
actor
&
other_dude
)
{
CAF_CHECKPOINT
();
self
->
trap_exit
(
true
);
...
...
@@ -44,7 +43,8 @@ behavior linking_dude(event_based_actor* self, const actor& other_dude) {
CAF_CHECKPOINT
();
return
{
[
self
](
const
exit_msg
&
)
{
CAF_CHECKPOINT
();
// must not been destroyed here
CAF_CHECK_EQUAL
(
s_dudes
.
load
(),
1
);
self
->
send
(
self
,
atom
(
"check"
));
},
on
(
atom
(
"check"
))
>>
[
self
]
{
...
...
@@ -62,7 +62,8 @@ behavior monitoring_dude(event_based_actor* self, actor other_dude) {
CAF_CHECKPOINT
();
return
{
[
self
](
const
down_msg
&
)
{
CAF_CHECKPOINT
();
// must not been destroyed here
CAF_CHECK_EQUAL
(
s_dudes
.
load
(),
1
);
self
->
send
(
self
,
atom
(
"check"
));
},
on
(
atom
(
"check"
))
>>
[
self
]
{
...
...
@@ -73,15 +74,28 @@ behavior monitoring_dude(event_based_actor* self, actor other_dude) {
};
}
void
test_actor_lifetime
()
{
spawn
(
monitoring_dude
,
spawn
<
dude
>
());
template
<
spawn_options
O1
,
spawn_options
O2
>
void
run
()
{
spawn
<
O1
>
(
linking_dude
,
spawn
<
dude
,
O2
>
());
await_all_actors_done
();
spawn
(
linking_dude
,
spawn
<
dude
>
());
spawn
<
O1
>
(
monitoring_dude
,
spawn
<
dude
,
O2
>
());
await_all_actors_done
();
}
void
test_actor_lifetime
()
{
CAF_PRINT
(
"run<no_spawn_options, no_spawn_options>"
);
run
<
no_spawn_options
,
no_spawn_options
>
();
CAF_PRINT
(
"run<detached, no_spawn_options>"
);
run
<
detached
,
no_spawn_options
>
();
CAF_PRINT
(
"run<no_spawn_options, detached>"
);
run
<
no_spawn_options
,
detached
>
();
CAF_PRINT
(
"run<detached, detached>"
);
run
<
detached
,
detached
>
();
}
int
main
()
{
CAF_TEST
(
test_actor_lifetime
);
test_actor_lifetime
();
CAF_CHECK_EQUAL
(
s_dudes
.
load
(),
0
);
return
CAF_TEST_RESULT
();
}
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