Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xs-test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patrick Chen
xs-test
Commits
5001e7da
Commit
5001e7da
authored
Aug 28, 2018
by
Patrick Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename variable 'condition_' to 'request_'
parent
977e708e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
Service.h
include/test/Service.h
+1
-1
Service.cc
src/test/Service.cc
+4
-4
Tester.cc
src/test/Tester.cc
+5
-5
No files found.
include/test/Service.h
View file @
5001e7da
...
...
@@ -32,7 +32,7 @@ namespace xs { namespace test
public
:
std
::
string
name_
;
boost
::
optional
<
nlohmann
::
json
>
condition
_
;
boost
::
optional
<
nlohmann
::
json
>
request
_
;
boost
::
optional
<
nlohmann
::
json
>
response_
;
};
}
}
...
...
src/test/Service.cc
View file @
5001e7da
...
...
@@ -15,8 +15,8 @@ namespace xs { namespace test
if
(
object
.
count
(
"command"
))
{
response_
=
object
[
"response"
];
if
(
object
.
count
(
"
condition
"
))
{
condition_
=
object
[
"condition
"
];
if
(
object
.
count
(
"
param
"
))
{
request_
=
object
[
"param
"
];
}
}
}
...
...
@@ -31,8 +31,8 @@ namespace xs { namespace test
return
object
.
is_string
()
||
object
.
is_object
();
};
if
(
object
.
count
(
"command"
))
{
if
(
object
.
count
(
"
condition
"
))
{
if
(
!
isStringOrObject
(
object
[
"
condition
"
]))
{
if
(
object
.
count
(
"
param
"
))
{
if
(
!
isStringOrObject
(
object
[
"
param
"
]))
{
return
false
;
}
}
...
...
src/test/Tester.cc
View file @
5001e7da
...
...
@@ -99,22 +99,22 @@ std::string Tester::onCommand(const std::string& name, const std::string& params
continue
;
}
if
(
!
handler
.
condition
_
)
{
if
(
!
handler
.
request
_
)
{
receivedCommandCount_
[
name
]
++
;
return
detail
::
toString
(
*
handler
.
response_
);
}
auto
&
receiveCount
=
receivedCommandCount_
[
name
];
const
auto
&
condition
=
*
handler
.
condition
_
;
const
bool
isString
=
condition
.
is_string
();
const
auto
&
request
=
*
handler
.
request
_
;
const
bool
isString
=
request
.
is_string
();
if
(
isString
)
{
if
(
params
==
condition
.
get
<
std
::
string
>
())
{
if
(
params
==
request
.
get
<
std
::
string
>
())
{
receiveCount
++
;
return
detail
::
toString
(
*
handler
.
response_
);
}
}
else
{
if
(
nlohmann
::
json
::
parse
(
params
)
==
condition
)
{
if
(
nlohmann
::
json
::
parse
(
params
)
==
request
)
{
receiveCount
++
;
return
detail
::
toString
(
*
handler
.
response_
);
}
...
...
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