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
84285fb1
Commit
84285fb1
authored
Oct 30, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting
parent
8607ad2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
71 deletions
+83
-71
libcaf_core/test/pipeline_streaming.cpp
libcaf_core/test/pipeline_streaming.cpp
+83
-71
No files found.
libcaf_core/test/pipeline_streaming.cpp
View file @
84285fb1
...
...
@@ -91,18 +91,20 @@ TESTEE(infinite_source) {
}
VARARGS_TESTEE
(
file_reader
,
size_t
buf_size
)
{
return
{[
=
](
string
&
fname
)
->
result
<
stream
<
int
>>
{
CAF_CHECK_EQUAL
(
fname
,
"numbers.txt"
);
CAF_CHECK_EQUAL
(
self
->
mailbox
().
empty
(),
true
);
return
attach_stream_source
(
self
,
init
(
buf_size
),
push_from_buf
,
is_done
(
self
),
fin
<
buf
>
(
self
));
},
[
=
](
string
&
fname
,
actor
next
)
{
CAF_CHECK_EQUAL
(
fname
,
"numbers.txt"
);
CAF_CHECK_EQUAL
(
self
->
mailbox
().
empty
(),
true
);
attach_stream_source
(
self
,
next
,
init
(
buf_size
),
push_from_buf
,
is_done
(
self
),
fin
<
buf
>
(
self
));
}};
return
{
[
=
](
string
&
fname
)
->
result
<
stream
<
int
>>
{
CAF_CHECK_EQUAL
(
fname
,
"numbers.txt"
);
CAF_CHECK_EQUAL
(
self
->
mailbox
().
empty
(),
true
);
return
attach_stream_source
(
self
,
init
(
buf_size
),
push_from_buf
,
is_done
(
self
),
fin
<
buf
>
(
self
));
},
[
=
](
string
&
fname
,
actor
next
)
{
CAF_CHECK_EQUAL
(
fname
,
"numbers.txt"
);
CAF_CHECK_EQUAL
(
self
->
mailbox
().
empty
(),
true
);
attach_stream_source
(
self
,
next
,
init
(
buf_size
),
push_from_buf
,
is_done
(
self
),
fin
<
buf
>
(
self
));
},
};
}
TESTEE_STATE
(
sum_up
)
{
...
...
@@ -111,16 +113,18 @@ TESTEE_STATE(sum_up) {
TESTEE
(
sum_up
)
{
using
intptr
=
int
*
;
return
{[
=
](
stream
<
int
>&
in
)
{
return
attach_stream_sink
(
self
,
// input stream
in
,
// initialize state
[
=
](
intptr
&
x
)
{
x
=
&
self
->
state
.
x
;
},
// processing step
[](
intptr
&
x
,
int
y
)
{
*
x
+=
y
;
},
fin
<
intptr
>
(
self
));
}};
return
{
[
=
](
stream
<
int
>&
in
)
{
return
attach_stream_sink
(
self
,
// input stream
in
,
// initialize state
[
=
](
intptr
&
x
)
{
x
=
&
self
->
state
.
x
;
},
// processing step
[](
intptr
&
x
,
int
y
)
{
*
x
+=
y
;
},
fin
<
intptr
>
(
self
));
},
};
}
TESTEE_STATE
(
delayed_sum_up
)
{
...
...
@@ -130,67 +134,75 @@ TESTEE_STATE(delayed_sum_up) {
TESTEE
(
delayed_sum_up
)
{
using
intptr
=
int
*
;
self
->
set_default_handler
(
skip
);
return
{[
=
](
ok_atom
)
{
self
->
become
([
=
](
stream
<
int
>&
in
)
{
self
->
set_default_handler
(
print_and_drop
);
return
attach_stream_sink
(
self
,
// input stream
in
,
// initialize state
[
=
](
intptr
&
x
)
{
x
=
&
self
->
state
.
x
;
},
// processing step
[](
intptr
&
x
,
int
y
)
{
*
x
+=
y
;
},
// cleanup
fin
<
intptr
>
(
self
));
});
}};
return
{
[
=
](
ok_atom
)
{
self
->
become
([
=
](
stream
<
int
>&
in
)
{
self
->
set_default_handler
(
print_and_drop
);
return
attach_stream_sink
(
self
,
// input stream
in
,
// initialize state
[
=
](
intptr
&
x
)
{
x
=
&
self
->
state
.
x
;
},
// processing step
[](
intptr
&
x
,
int
y
)
{
*
x
+=
y
;
},
// cleanup
fin
<
intptr
>
(
self
));
});
},
};
}
TESTEE
(
broken_sink
)
{
CAF_IGNORE_UNUSED
(
self
);
return
{[
=
](
stream
<
int
>&
,
const
actor
&
)
{
// nop
}};
return
{
[
=
](
stream
<
int
>&
,
const
actor
&
)
{
// nop
},
};
}
TESTEE
(
filter
)
{
CAF_IGNORE_UNUSED
(
self
);
return
{[
=
](
stream
<
int
>&
in
)
{
return
attach_stream_stage
(
self
,
// input stream
in
,
// initialize state
[](
unit_t
&
)
{
// nop
},
// processing step
[](
unit_t
&
,
downstream
<
int
>&
out
,
int
x
)
{
if
((
x
&
0x01
)
!=
0
)
out
.
push
(
x
);
},
// cleanup
fin
<
unit_t
>
(
self
));
}};
return
{
[
=
](
stream
<
int
>&
in
)
{
return
attach_stream_stage
(
self
,
// input stream
in
,
// initialize state
[](
unit_t
&
)
{
// nop
},
// processing step
[](
unit_t
&
,
downstream
<
int
>&
out
,
int
x
)
{
if
((
x
&
0x01
)
!=
0
)
out
.
push
(
x
);
},
// cleanup
fin
<
unit_t
>
(
self
));
},
};
}
TESTEE
(
doubler
)
{
CAF_IGNORE_UNUSED
(
self
);
return
{[
=
](
stream
<
int
>&
in
)
{
return
attach_stream_stage
(
self
,
// input stream
in
,
// initialize state
[](
unit_t
&
)
{
// nop
},
// processing step
[](
unit_t
&
,
downstream
<
int
>&
out
,
int
x
)
{
out
.
push
(
x
*
2
);
},
// cleanup
fin
<
unit_t
>
(
self
));
}};
return
{
[
=
](
stream
<
int
>&
in
)
{
return
attach_stream_stage
(
self
,
// input stream
in
,
// initialize state
[](
unit_t
&
)
{
// nop
},
// processing step
[](
unit_t
&
,
downstream
<
int
>&
out
,
int
x
)
{
out
.
push
(
x
*
2
);
},
// cleanup
fin
<
unit_t
>
(
self
));
},
};
}
struct
fixture
:
test_coordinator_fixture
<>
{
...
...
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