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
98f05215
Commit
98f05215
authored
Jun 16, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix leak in `constructor_attach` unit test
parent
d071989a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
libcaf_core/test/constructor_attach.cpp
libcaf_core/test/constructor_attach.cpp
+11
-4
No files found.
libcaf_core/test/constructor_attach.cpp
View file @
98f05215
...
@@ -34,11 +34,12 @@ using done_atom = atom_constant<atom("done")>;
...
@@ -34,11 +34,12 @@ using done_atom = atom_constant<atom("done")>;
CAF_TEST
(
constructor_attach
)
{
CAF_TEST
(
constructor_attach
)
{
class
testee
:
public
event_based_actor
{
class
testee
:
public
event_based_actor
{
public:
public:
explicit
testee
(
actor
buddy
)
:
buddy_
(
buddy
)
{
explicit
testee
(
actor
buddy
)
{
attach_functor
([
=
](
uint32_t
reason
)
{
attach_functor
([
=
](
uint32_t
reason
)
{
send
(
buddy
_
,
done_atom
::
value
,
reason
);
send
(
buddy
,
done_atom
::
value
,
reason
);
});
});
}
}
behavior
make_behavior
()
{
behavior
make_behavior
()
{
return
{
return
{
[
=
](
die_atom
)
{
[
=
](
die_atom
)
{
...
@@ -46,18 +47,19 @@ CAF_TEST(constructor_attach) {
...
@@ -46,18 +47,19 @@ CAF_TEST(constructor_attach) {
}
}
};
};
}
}
private:
actor
buddy_
;
};
};
class
spawner
:
public
event_based_actor
{
class
spawner
:
public
event_based_actor
{
public:
public:
spawner
()
:
downs_
(
0
)
{
spawner
()
:
downs_
(
0
)
{
// nop
}
}
behavior
make_behavior
()
{
behavior
make_behavior
()
{
testee_
=
spawn
<
testee
,
monitored
>
(
this
);
testee_
=
spawn
<
testee
,
monitored
>
(
this
);
return
{
return
{
[
=
](
const
down_msg
&
msg
)
{
[
=
](
const
down_msg
&
msg
)
{
CAF_CHECK_EQUAL
(
msg
.
reason
,
exit_reason
::
user_shutdown
);
CAF_CHECK_EQUAL
(
msg
.
reason
,
exit_reason
::
user_shutdown
);
CAF_CHECK
(
msg
.
source
==
testee_
);
if
(
++
downs_
==
2
)
{
if
(
++
downs_
==
2
)
{
quit
(
msg
.
reason
);
quit
(
msg
.
reason
);
}
}
...
@@ -73,6 +75,11 @@ CAF_TEST(constructor_attach) {
...
@@ -73,6 +75,11 @@ CAF_TEST(constructor_attach) {
}
}
};
};
}
}
void
on_exit
()
{
testee_
=
invalid_actor
;
}
private:
private:
int
downs_
;
int
downs_
;
actor
testee_
;
actor
testee_
;
...
...
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