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
4cdba90f
Commit
4cdba90f
authored
Jan 07, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made spawn unit test more verbose
parent
e5c88dfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
unit_testing/test__spawn.cpp
unit_testing/test__spawn.cpp
+22
-5
No files found.
unit_testing/test__spawn.cpp
View file @
4cdba90f
...
@@ -484,6 +484,7 @@ int main() {
...
@@ -484,6 +484,7 @@ int main() {
await_all_others_done
();
await_all_others_done
();
CPPA_IF_VERBOSE
(
cout
<<
"ok"
<<
endl
);
CPPA_IF_VERBOSE
(
cout
<<
"ok"
<<
endl
);
CPPA_IF_VERBOSE
(
cout
<<
"test sync send with factory spawned actor ... "
<<
flush
);
auto
sync_testee_factory
=
factory
::
event_based
(
auto
sync_testee_factory
=
factory
::
event_based
(
[
&
]()
{
[
&
]()
{
self
->
become
(
self
->
become
(
...
@@ -510,25 +511,39 @@ int main() {
...
@@ -510,25 +511,39 @@ int main() {
);
);
}
}
);
);
CPPA_CHECK
(
true
);
auto
sync_testee
=
sync_testee_factory
.
spawn
();
auto
sync_testee
=
sync_testee_factory
.
spawn
();
self
->
monitor
(
sync_testee
);
send
(
sync_testee
,
"hi"
);
send
(
sync_testee
,
"hi"
);
receive
(
receive
(
on
(
"whassup?"
)
>>
[]()
{
on
(
"whassup?"
)
>>
[
&
]
{
CPPA_CHECK
(
true
);
// this is NOT a reply, it's just an asynchronous message
// this is NOT a reply, it's just an asynchronous message
send
(
self
->
last_sender
(),
"a lot!"
);
send
(
self
->
last_sender
(),
"a lot!"
);
reply
(
"nothing"
);
reply
(
"nothing"
);
}
}
);
);
receive
(
receive
(
on
(
"goodbye!"
)
>>
[]()
{
}
on
(
"goodbye!"
)
>>
[
&
]
{
CPPA_CHECK
(
true
);
}
);
CPPA_CHECK
(
true
);
receive
(
on
(
atom
(
"DOWN"
),
exit_reason
::
normal
)
>>
[
&
]
{
CPPA_CHECK
(
self
->
last_sender
()
==
sync_testee
);
}
);
);
await_all_others_done
();
await_all_others_done
();
CPPA_IF_VERBOSE
(
cout
<<
"ok"
<<
endl
);
receive_response
(
sync_send
(
sync_testee
,
"!?"
))
(
receive_response
(
sync_send
(
sync_testee
,
"!?"
))
(
others
()
>>
[
&
]()
{
others
()
>>
[
&
]()
{
CPPA_ERROR
(
"'sync_testee' still alive?"
);
CPPA_ERROR
(
"'sync_testee' still alive?"
);
},
},
after
(
chrono
::
milliseconds
(
5
))
>>
[]()
{
}
after
(
chrono
::
milliseconds
(
5
))
>>
[
&
]
{
CPPA_CHECK
(
true
);
}
);
);
auto
inflater
=
factory
::
event_based
(
auto
inflater
=
factory
::
event_based
(
...
@@ -547,10 +562,12 @@ int main() {
...
@@ -547,10 +562,12 @@ int main() {
auto
bob
=
inflater
.
spawn
(
"Bob"
,
joe
);
auto
bob
=
inflater
.
spawn
(
"Bob"
,
joe
);
send
(
bob
,
1
,
"hello actor"
);
send
(
bob
,
1
,
"hello actor"
);
receive
(
receive
(
on
(
4
,
"hello actor"
)
>>
[]()
{
on
(
4
,
"hello actor"
)
>>
[
&
]
{
CPPA_CHECK
(
true
);
// done
// done
},
},
others
()
>>
[]
{
others
()
>>
[
&
]
{
CPPA_ERROR
(
"unexpected result"
);
cerr
<<
"unexpected: "
<<
to_string
(
self
->
last_dequeued
())
<<
endl
;
cerr
<<
"unexpected: "
<<
to_string
(
self
->
last_dequeued
())
<<
endl
;
}
}
);
);
...
...
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