Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
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
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
Libraries
json
Commits
f574d7e0
Commit
f574d7e0
authored
Jun 13, 2018
by
Vitaliy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify templates for operators, add more checks
parent
cd28d872
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
test/src/unit-alt-string.cpp
test/src/unit-alt-string.cpp
+11
-18
No files found.
test/src/unit-alt-string.cpp
View file @
f574d7e0
...
...
@@ -66,12 +66,7 @@ class alt_string
}
template
<
typename
op_type
>
typename
std
::
enable_if
<
// disable for alt_string
!
std
::
is_same
<
alt_string
,
typename
std
::
remove_reference
<
op_type
>::
type
>::
value
,
bool
>::
type
operator
==
(
op_type
&&
op
)
const
bool
operator
==
(
const
op_type
&
op
)
const
{
return
str_impl
==
op
;
}
...
...
@@ -82,12 +77,7 @@ class alt_string
}
template
<
typename
op_type
>
typename
std
::
enable_if
<
// disable for alt_string
!
std
::
is_same
<
alt_string
,
typename
std
::
remove_reference
<
op_type
>::
type
>::
value
,
bool
>::
type
operator
!=
(
op_type
&&
op
)
const
bool
operator
!=
(
const
op_type
&
op
)
const
{
return
str_impl
!=
op
;
}
...
...
@@ -112,12 +102,7 @@ class alt_string
}
template
<
typename
op_type
>
typename
std
::
enable_if
<
// disable for alt_string
!
std
::
is_same
<
alt_string
,
typename
std
::
remove_reference
<
op_type
>::
type
>::
value
,
bool
>::
type
operator
<
(
op_type
&&
op
)
const
bool
operator
<
(
const
op_type
&
op
)
const
{
return
str_impl
<
op
;
}
...
...
@@ -255,18 +240,26 @@ TEST_CASE("alternative string type")
CHECK
(
"I'm Batman"
==
doc
[
"Who are you?"
]);
CHECK
(
doc
[
"Who are you?"
]
==
"I'm Batman"
);
CHECK_FALSE
(
"I'm Batman"
!=
doc
[
"Who are you?"
]);
CHECK_FALSE
(
doc
[
"Who are you?"
]
!=
"I'm Batman"
);
CHECK
(
"I'm Bruce Wayne"
!=
doc
[
"Who are you?"
]);
CHECK
(
doc
[
"Who are you?"
]
!=
"I'm Bruce Wayne"
);
CHECK_FALSE
(
"I'm Bruce Wayne"
==
doc
[
"Who are you?"
]);
CHECK_FALSE
(
doc
[
"Who are you?"
]
==
"I'm Bruce Wayne"
);
{
const
alt_json
&
const_doc
=
doc
;
CHECK
(
"I'm Batman"
==
const_doc
[
"Who are you?"
]);
CHECK
(
const_doc
[
"Who are you?"
]
==
"I'm Batman"
);
CHECK_FALSE
(
"I'm Batman"
!=
const_doc
[
"Who are you?"
]);
CHECK_FALSE
(
const_doc
[
"Who are you?"
]
!=
"I'm Batman"
);
CHECK
(
"I'm Bruce Wayne"
!=
const_doc
[
"Who are you?"
]);
CHECK
(
const_doc
[
"Who are you?"
]
!=
"I'm Bruce Wayne"
);
CHECK_FALSE
(
"I'm Bruce Wayne"
==
const_doc
[
"Who are you?"
]);
CHECK_FALSE
(
const_doc
[
"Who are you?"
]
==
"I'm Bruce Wayne"
);
}
}
}
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