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
ea9ffd8f
Commit
ea9ffd8f
authored
Jan 03, 2018
by
Dominik Charousset
Committed by
Dominik Charousset
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make .with optional in expected() clauses
parent
cbd91767
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
10 deletions
+40
-10
libcaf_test/caf/test/dsl.hpp
libcaf_test/caf/test/dsl.hpp
+40
-10
No files found.
libcaf_test/caf/test/dsl.hpp
View file @
ea9ffd8f
...
@@ -174,6 +174,12 @@ public:
...
@@ -174,6 +174,12 @@ public:
// nop
// nop
}
}
virtual
~
expect_clause_base
()
{
CAF_ASSERT
(
peek_
!=
nullptr
);
peek_
();
run_once
();
}
Derived
&
from
(
const
wildcard
&
)
{
Derived
&
from
(
const
wildcard
&
)
{
return
dref
();
return
dref
();
}
}
...
@@ -191,7 +197,7 @@ public:
...
@@ -191,7 +197,7 @@ public:
auto
ptr
=
peek_mailbox
(
dest_
);
auto
ptr
=
peek_mailbox
(
dest_
);
CAF_REQUIRE
(
ptr
!=
nullptr
);
CAF_REQUIRE
(
ptr
!=
nullptr
);
if
(
src_
)
if
(
src_
)
CAF_
REQUIRE
_EQUAL
(
ptr
->
sender
,
src_
);
CAF_
CHECK
_EQUAL
(
ptr
->
sender
,
src_
);
return
dref
();
return
dref
();
}
}
...
@@ -237,6 +243,7 @@ protected:
...
@@ -237,6 +243,7 @@ protected:
bool
mock_dest_
;
bool
mock_dest_
;
caf
::
strong_actor_ptr
src_
;
caf
::
strong_actor_ptr
src_
;
caf
::
local_actor
*
dest_
;
caf
::
local_actor
*
dest_
;
std
::
function
<
void
()
>
peek_
;
};
};
template
<
class
...
Ts
>
template
<
class
...
Ts
>
...
@@ -245,16 +252,20 @@ public:
...
@@ -245,16 +252,20 @@ public:
template
<
class
...
Us
>
template
<
class
...
Us
>
expect_clause
(
Us
&&
...
xs
)
expect_clause
(
Us
&&
...
xs
)
:
expect_clause_base
<
expect_clause
<
Ts
...
>>
(
std
::
forward
<
Us
>
(
xs
)...)
{
:
expect_clause_base
<
expect_clause
<
Ts
...
>>
(
std
::
forward
<
Us
>
(
xs
)...)
{
// nop
this
->
peek_
=
[
=
]
{
this
->
template
peek
<
Ts
...>();
};
}
}
template
<
class
...
Us
>
template
<
class
...
Us
>
void
with
(
Us
&&
...
xs
)
{
void
with
(
Us
&&
...
xs
)
{
// TODO: move tmp into lambda when switching to C++14
auto
tmp
=
std
::
make_tuple
(
std
::
forward
<
Us
>
(
xs
)...);
auto
tmp
=
std
::
make_tuple
(
std
::
forward
<
Us
>
(
xs
)...);
elementwise_compare_inspector
<
decltype
(
tmp
)
>
inspector
{
tmp
};
this
->
peek_
=
[
=
]
{
auto
ys
=
this
->
template
peek
<
Ts
...>();
elementwise_compare_inspector
<
decltype
(
tmp
)
>
inspector
{
tmp
};
CAF_CHECK
(
inspector
(
get
<
0
>
(
ys
)));
auto
ys
=
this
->
template
peek
<
Ts
...>();
this
->
run_once
();
CAF_CHECK
(
inspector
(
get
<
0
>
(
ys
)));
};
}
}
};
};
...
@@ -266,15 +277,21 @@ public:
...
@@ -266,15 +277,21 @@ public:
template
<
class
...
Us
>
template
<
class
...
Us
>
expect_clause
(
Us
&&
...
xs
)
expect_clause
(
Us
&&
...
xs
)
:
expect_clause_base
<
expect_clause
<
T
>>
(
std
::
forward
<
Us
>
(
xs
)...)
{
:
expect_clause_base
<
expect_clause
<
T
>>
(
std
::
forward
<
Us
>
(
xs
)...)
{
// nop
this
->
peek_
=
[
=
]
{
std
::
integral_constant
<
bool
,
has_outer_type
<
T
>::
value
>
token
;
type_check
<
T
>
(
token
);
};
}
}
template
<
class
...
Us
>
template
<
class
...
Us
>
void
with
(
Us
&&
...
xs
)
{
void
with
(
Us
&&
...
xs
)
{
std
::
integral_constant
<
bool
,
has_outer_type
<
T
>::
value
>
token
;
// TODO: move tmp into lambda when switching to C++14
auto
tmp
=
std
::
make_tuple
(
std
::
forward
<
Us
>
(
xs
)...);
auto
tmp
=
std
::
make_tuple
(
std
::
forward
<
Us
>
(
xs
)...);
with_content
(
token
,
tmp
);
this
->
peek_
=
[
=
]
{
this
->
run_once
();
std
::
integral_constant
<
bool
,
has_outer_type
<
T
>::
value
>
token
;
with_content
(
token
,
tmp
);
};
}
}
private:
private:
...
@@ -296,6 +313,19 @@ private:
...
@@ -296,6 +313,19 @@ private:
CAF_CHECK
(
inspect
(
inspector
,
const_cast
<
T
&>
(
get
<
T
>
(
x0
))));
CAF_CHECK
(
inspect
(
inspector
,
const_cast
<
T
&>
(
get
<
T
>
(
x0
))));
}
}
template
<
class
U
>
void
type_check
(
std
::
integral_constant
<
bool
,
false
>
)
{
this
->
template
peek
<
U
>();
}
template
<
class
U
>
void
type_check
(
std
::
integral_constant
<
bool
,
true
>
)
{
auto
xs
=
this
->
template
peek
<
typename
U
::
outer_type
>();
auto
&
x0
=
get
<
0
>
(
xs
);
if
(
!
is
<
U
>
(
x0
))
{
CAF_FAIL
(
"is<T>(x0) !! "
<<
caf
::
deep_to_string
(
x0
));
}
}
};
};
template
<
>
template
<
>
...
...
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