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
a075cee3
Commit
a075cee3
authored
Oct 30, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply clang-format to dsl.hpp
parent
73e3848f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
30 deletions
+24
-30
libcaf_test/caf/test/dsl.hpp
libcaf_test/caf/test/dsl.hpp
+24
-30
No files found.
libcaf_test/caf/test/dsl.hpp
View file @
a075cee3
...
...
@@ -29,7 +29,7 @@
CAF_PUSH_WARNINGS
/// The type of `_`.
struct
wildcard
{
};
struct
wildcard
{};
/// Allows ignoring individual messages elements in `expect` clauses, e.g.
/// `expect((int, int), from(foo).to(bar).with(1, _))`.
...
...
@@ -76,7 +76,7 @@ bool operator==(const message& x, const T& y) {
}
// namespace caf
// dummy function to force ADL later on
//int inspect(int, int);
//
int inspect(int, int);
template
<
class
T
>
struct
has_outer_type
{
...
...
@@ -123,19 +123,13 @@ private:
}
template
<
size_t
X
,
class
T
,
class
...
Ts
>
typename
std
::
enable_if
<
caf
::
meta
::
is_annotation
<
T
>::
value
,
bool
>::
type
typename
std
::
enable_if
<
caf
::
meta
::
is_annotation
<
T
>::
value
,
bool
>::
type
iterate
(
pos
<
X
>
pos
,
const
T
&
,
const
Ts
&
...
ys
)
{
return
iterate
(
pos
,
ys
...);
}
template
<
size_t
X
,
class
T
,
class
...
Ts
>
typename
std
::
enable_if
<
!
caf
::
meta
::
is_annotation
<
T
>::
value
,
bool
>::
type
typename
std
::
enable_if
<!
caf
::
meta
::
is_annotation
<
T
>::
value
,
bool
>::
type
iterate
(
pos
<
X
>
,
const
T
&
y
,
const
Ts
&
...
ys
)
{
std
::
integral_constant
<
size_t
,
X
+
1
>
next
;
check
(
y
,
get
<
X
>
(
xs_
));
...
...
@@ -286,8 +280,8 @@ std::tuple<T, Ts...> extract(caf_handle x) {
auto
ptr
=
x
->
peek_at_next_mailbox_element
();
if
(
ptr
==
nullptr
)
CAF_FAIL
(
"Mailbox is empty"
);
CAF_FAIL
(
"Message does not match expected pattern: "
<<
to_string
(
ptr
->
content
()));
CAF_FAIL
(
"Message does not match expected pattern: "
<<
to_string
(
ptr
->
content
()));
}
return
std
::
move
(
*
result
);
}
...
...
@@ -301,8 +295,7 @@ template <class... Ts>
class
expect_clause
{
public:
expect_clause
(
caf
::
scheduler
::
test_coordinator
&
sched
)
:
sched_
(
sched
),
dest_
(
nullptr
)
{
:
sched_
(
sched
),
dest_
(
nullptr
)
{
peek_
=
[
=
]
{
/// The extractor will call CAF_FAIL on a type mismatch, essentially
/// performing a type check when ignoring the result.
...
...
@@ -350,7 +343,7 @@ public:
// TODO: replace this workaround with the make_tuple() line when dropping
// support for GCC 4.8.
std
::
tuple
<
typename
std
::
decay
<
Us
>::
type
...
>
tmp
{
std
::
forward
<
Us
>
(
xs
)...};
//auto tmp = std::make_tuple(std::forward<Us>(xs)...);
//
auto tmp = std::make_tuple(std::forward<Us>(xs)...);
// TODO: move tmp into lambda when switching to C++14
peek_
=
[
=
]
{
using
namespace
caf
::
detail
;
...
...
@@ -373,7 +366,7 @@ protected:
caf
::
scheduler
::
test_coordinator
&
sched_
;
caf
::
strong_actor_ptr
src_
;
caf
::
abstract_actor
*
dest_
;
std
::
function
<
void
()
>
peek_
;
std
::
function
<
void
()
>
peek_
;
};
template
<
>
...
...
@@ -504,8 +497,7 @@ template <class... Ts>
class
allow_clause
{
public:
allow_clause
(
caf
::
scheduler
::
test_coordinator
&
sched
)
:
sched_
(
sched
),
dest_
(
nullptr
)
{
:
sched_
(
sched
),
dest_
(
nullptr
)
{
peek_
=
[
=
]
{
if
(
dest_
!=
nullptr
)
return
try_extract
<
Ts
...
>
(
dest_
)
!=
caf
::
none
;
...
...
@@ -581,7 +573,7 @@ protected:
caf
::
scheduler
::
test_coordinator
&
sched_
;
caf
::
strong_actor_ptr
src_
;
caf
::
abstract_actor
*
dest_
;
std
::
function
<
bool
()
>
peek_
;
std
::
function
<
bool
()
>
peek_
;
};
template
<
class
...
Ts
>
...
...
@@ -648,7 +640,7 @@ public:
protected:
caf_handle
src_
;
caf_handle
dest_
;
std
::
function
<
void
()
>
check_
;
std
::
function
<
void
()
>
check_
;
};
template
<
class
...
Ts
>
...
...
@@ -657,9 +649,10 @@ struct test_coordinator_fixture_fetch_helper {
std
::
tuple
<
Ts
...
>
operator
()(
caf
::
response_handle
<
Self
,
Interface
,
true
>&
from
)
const
{
std
::
tuple
<
Ts
...
>
result
;
from
.
receive
(
[
&
](
Ts
&
...
xs
)
{
result
=
std
::
make_tuple
(
std
::
move
(
xs
)...);
},
[
&
](
caf
::
error
&
err
)
{
FAIL
(
from
.
self
()
->
system
().
render
(
err
));
});
from
.
receive
([
&
](
Ts
&
...
xs
)
{
result
=
std
::
make_tuple
(
std
::
move
(
xs
)...);
},
[
&
](
caf
::
error
&
err
)
{
FAIL
(
from
.
self
()
->
system
().
render
(
err
));
});
return
result
;
}
};
...
...
@@ -669,9 +662,10 @@ struct test_coordinator_fixture_fetch_helper<T> {
template
<
class
Self
,
class
Interface
>
T
operator
()(
caf
::
response_handle
<
Self
,
Interface
,
true
>&
from
)
const
{
T
result
;
from
.
receive
(
[
&
](
T
&
x
)
{
result
=
std
::
move
(
x
);
},
[
&
](
caf
::
error
&
err
)
{
FAIL
(
from
.
self
()
->
system
().
render
(
err
));
});
from
.
receive
([
&
](
T
&
x
)
{
result
=
std
::
move
(
x
);
},
[
&
](
caf
::
error
&
err
)
{
FAIL
(
from
.
self
()
->
system
().
render
(
err
));
});
return
result
;
}
};
...
...
@@ -705,10 +699,10 @@ public:
template
<
class
...
Ts
>
explicit
test_coordinator_fixture
(
Ts
&&
...
xs
)
:
cfg
(
std
::
forward
<
Ts
>
(
xs
)...),
sys
(
init_config
(
cfg
)),
self
(
sys
,
true
),
sched
(
dynamic_cast
<
scheduler_type
&>
(
sys
.
scheduler
()))
{
:
cfg
(
std
::
forward
<
Ts
>
(
xs
)...),
sys
(
init_config
(
cfg
)),
self
(
sys
,
true
),
sched
(
dynamic_cast
<
scheduler_type
&>
(
sys
.
scheduler
()))
{
// Configure the clock to measure each batch item with 1us.
sched
.
clock
().
time_per_unit
.
emplace
(
caf
::
atom
(
"batch"
),
caf
::
timespan
{
1000
});
...
...
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