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
b9388f29
Commit
b9388f29
authored
Jun 03, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-implement unit test for local groups
parent
62767a6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
unit_testing/test_local_group.cpp
unit_testing/test_local_group.cpp
+17
-11
No files found.
unit_testing/test_local_group.cpp
View file @
b9388f29
...
@@ -23,9 +23,12 @@ using namespace cppa;
...
@@ -23,9 +23,12 @@ using namespace cppa;
void
testee
(
event_based_actor
*
self
,
int
current_value
,
int
final_result
)
{
void
testee
(
event_based_actor
*
self
,
int
current_value
,
int
final_result
)
{
self
->
become
(
self
->
become
(
on_arg_match
>>
[
=
](
int
result
)
{
[
=
](
int
result
)
{
auto
next
=
result
+
current_value
;
auto
next
=
result
+
current_value
;
if
(
next
>=
final_result
)
self
->
quit
();
if
(
next
>=
final_result
)
{
CPPA_CHECKPOINT
();
self
->
quit
();
}
else
testee
(
self
,
next
,
final_result
);
else
testee
(
self
,
next
,
final_result
);
},
},
after
(
std
::
chrono
::
seconds
(
2
))
>>
[
=
]
{
after
(
std
::
chrono
::
seconds
(
2
))
>>
[
=
]
{
...
@@ -35,23 +38,26 @@ void testee(event_based_actor* self, int current_value, int final_result) {
...
@@ -35,23 +38,26 @@ void testee(event_based_actor* self, int current_value, int final_result) {
);
);
}
}
int
main
()
{
void
test_local_group
()
{
CPPA_TEST
(
test_local_group
);
scoped_actor
self
;
/*
auto
foo_group
=
group
::
get
(
"local"
,
"foo"
);
auto
foo_group
=
group
::
get
(
"local"
,
"foo"
);
auto
master
=
spawn_in_group
(
foo_group
,
testee
,
0
,
10
);
auto
master
=
spawn_in_group
(
foo_group
,
testee
,
0
,
10
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
// spawn five workers and let them join local/foo
// spawn five workers and let them join local/foo
s
pawn_in_group(foo_group, [master]
{
s
elf
->
spawn_in_group
(
foo_group
,
[
master
](
event_based_actor
*
m
)
{
become(on_arg_match >> [master
](int v) {
m
->
become
([
master
,
m
](
int
v
)
{
send(master, v);
m
->
send
(
master
,
v
);
self
->quit();
m
->
quit
();
});
});
});
});
}
}
send(foo_group, 2);
self
->
send
(
foo_group
,
2
);
}
int
main
()
{
CPPA_TEST
(
test_local_group
);
test_local_group
();
await_all_actors_done
();
await_all_actors_done
();
shutdown
();
shutdown
();
*/
return
CPPA_TEST_RESULT
();
return
CPPA_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