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
7fdfbfb4
Commit
7fdfbfb4
authored
May 14, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test for passing std::cref(...) to an actor
parent
0bf5d7d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
unit_testing/test__spawn.cpp
unit_testing/test__spawn.cpp
+53
-0
No files found.
unit_testing/test__spawn.cpp
View file @
7fdfbfb4
...
...
@@ -270,6 +270,41 @@ std::string behavior_test(actor_ptr et) {
return
result
;
}
class
str_wrapper
{
str_wrapper
()
=
delete
;
str_wrapper
(
str_wrapper
&&
)
=
delete
;
str_wrapper
(
const
str_wrapper
&
)
=
delete
;
public:
inline
str_wrapper
(
std
::
string
s
)
:
m_str
(
s
)
{
}
const
std
::
string
&
str
()
const
{
return
m_str
;
}
private:
std
::
string
m_str
;
};
bool
operator
==
(
const
str_wrapper
&
lhs
,
const
std
::
string
&
rhs
)
{
return
lhs
.
str
()
==
rhs
;
}
void
foobar
(
const
str_wrapper
&
x
,
const
std
::
string
&
y
)
{
receive
(
on
(
atom
(
"same"
)).
when
(
gref
(
x
)
==
gref
(
y
))
>>
[
&
]()
{
reply
(
atom
(
"yes"
));
},
on
(
atom
(
"same"
))
>>
[
&
]()
{
reply
(
atom
(
"no"
));
}
);
}
size_t
test__spawn
()
{
CPPA_TEST
(
test__spawn
);
...
...
@@ -316,6 +351,24 @@ size_t test__spawn() {
await_all_others_done
();
CPPA_IF_VERBOSE
(
cout
<<
"ok"
<<
endl
);
{
bool
invoked
=
false
;
str_wrapper
x
{
"x"
};
std
::
string
y
{
"y"
};
auto
foo_actor
=
spawn
(
foobar
,
std
::
cref
(
x
),
y
);
send
(
foo_actor
,
atom
(
"same"
));
receive
(
on
(
atom
(
"yes"
))
>>
[
&
]()
{
CPPA_ERROR
(
"x == y"
);
},
on
(
atom
(
"no"
))
>>
[
&
]()
{
invoked
=
true
;
}
);
CPPA_CHECK_EQUAL
(
true
,
invoked
);
await_all_others_done
();
}
CPPA_CHECK_EQUAL
(
behavior_test
<
testee_actor
>
(
spawn
(
testee_actor
{})),
"wait4int"
);
CPPA_CHECK_EQUAL
(
behavior_test
<
event_testee
>
(
spawn
(
new
event_testee
)),
"wait4int"
);
...
...
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