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
7c226fbc
Commit
7c226fbc
authored
Mar 13, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use config_option::parse in unit test
parent
b01cc5e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
libcaf_core/src/make_config_option.cpp
libcaf_core/src/make_config_option.cpp
+2
-1
libcaf_core/test/config_option.cpp
libcaf_core/test/config_option.cpp
+5
-4
No files found.
libcaf_core/src/make_config_option.cpp
View file @
7c226fbc
...
...
@@ -138,7 +138,8 @@ DEFAULT_META(size_t, default_config_option_parse<size_t>)
DEFAULT_META
(
string
,
parse_string
)
config_option
::
meta_state
bool_meta_state
{
bool_check
,
bool_store
,
bool_get
,
nullptr
,
detail
::
type_name
<
bool
>
()};
default_config_option_parse
<
bool
>
,
detail
::
type_name
<
bool
>
()};
}
// namespace detail
...
...
libcaf_core/test/config_option.cpp
View file @
7c226fbc
...
...
@@ -47,7 +47,7 @@ constexpr int64_t underflow() {
template
<
class
T
>
optional
<
T
>
read
(
string_view
arg
)
{
auto
co
=
make_config_option
<
T
>
(
category
,
name
,
explanation
);
auto
res
=
co
nfig_value
::
parse
(
arg
);
auto
res
=
co
.
parse
(
arg
);
if
(
res
&&
holds_alternative
<
T
>
(
*
res
))
{
CAF_CHECK_EQUAL
(
co
.
check
(
*
res
),
none
);
return
get
<
T
>
(
*
res
);
...
...
@@ -167,13 +167,14 @@ CAF_TEST(type double) {
}
CAF_TEST
(
type
string
)
{
CAF_CHECK_EQUAL
(
unbox
(
read
<
string
>
(
"
\"
foo
\"
"
)),
"foo"
);
CAF_CHECK_EQUAL
(
unbox
(
read
<
string
>
(
"foo"
)),
"foo"
);
CAF_CHECK_EQUAL
(
unbox
(
read
<
string
>
(
"
\"
foo
\"
"
)),
"
\"
foo
\"
"
);
}
CAF_TEST
(
type
atom
)
{
CAF_CHECK_EQUAL
(
unbox
(
read
<
atom_value
>
(
"'foo'"
)),
atom
(
"foo"
));
CAF_CHECK_EQUAL
(
read
<
atom_value
>
(
"bar"
),
none
);
CAF_CHECK_EQUAL
(
unbox
(
read
<
atom_value
>
(
"foo"
)),
atom
(
"foo"
));
CAF_CHECK_EQUAL
(
read
<
atom_value
>
(
"toomanycharacters"
),
none
);
CAF_CHECK_EQUAL
(
read
<
atom_value
>
(
"illegal!"
),
none
);
}
CAF_TEST
(
type
timespan
)
{
...
...
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