Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
2ce91b82
Commit
2ce91b82
authored
Dec 17, 2018
by
ylavic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pointer tests now need <algorithm> (for std::swap), but no tabs.
parent
a66cf792
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
25 deletions
+26
-25
pointertest.cpp
test/unittest/pointertest.cpp
+26
-25
No files found.
test/unittest/pointertest.cpp
View file @
2ce91b82
...
...
@@ -16,6 +16,7 @@
#include "rapidjson/pointer.h"
#include "rapidjson/stringbuffer.h"
#include <sstream>
#include <algorithm>
using
namespace
rapidjson
;
...
...
@@ -530,33 +531,33 @@ TEST(Pointer, Assignment) {
}
TEST
(
Pointer
,
Swap
)
{
Pointer
p
(
"/foo/0"
);
Pointer
q
(
&
p
.
GetAllocator
());
q
.
Swap
(
p
);
EXPECT_EQ
(
&
q
.
GetAllocator
(),
&
p
.
GetAllocator
());
EXPECT_TRUE
(
p
.
IsValid
());
EXPECT_TRUE
(
q
.
IsValid
());
EXPECT_EQ
(
0u
,
p
.
GetTokenCount
());
EXPECT_EQ
(
2u
,
q
.
GetTokenCount
());
EXPECT_EQ
(
3u
,
q
.
GetTokens
()[
0
].
length
);
EXPECT_STREQ
(
"foo"
,
q
.
GetTokens
()[
0
].
name
);
EXPECT_EQ
(
1u
,
q
.
GetTokens
()[
1
].
length
);
EXPECT_STREQ
(
"0"
,
q
.
GetTokens
()[
1
].
name
);
EXPECT_EQ
(
0u
,
q
.
GetTokens
()[
1
].
index
);
Pointer
p
(
"/foo/0"
);
Pointer
q
(
&
p
.
GetAllocator
());
q
.
Swap
(
p
);
EXPECT_EQ
(
&
q
.
GetAllocator
(),
&
p
.
GetAllocator
());
EXPECT_TRUE
(
p
.
IsValid
());
EXPECT_TRUE
(
q
.
IsValid
());
EXPECT_EQ
(
0u
,
p
.
GetTokenCount
());
EXPECT_EQ
(
2u
,
q
.
GetTokenCount
());
EXPECT_EQ
(
3u
,
q
.
GetTokens
()[
0
].
length
);
EXPECT_STREQ
(
"foo"
,
q
.
GetTokens
()[
0
].
name
);
EXPECT_EQ
(
1u
,
q
.
GetTokens
()[
1
].
length
);
EXPECT_STREQ
(
"0"
,
q
.
GetTokens
()[
1
].
name
);
EXPECT_EQ
(
0u
,
q
.
GetTokens
()[
1
].
index
);
// std::swap compatibility
std
::
swap
(
p
,
q
);
EXPECT_EQ
(
&
p
.
GetAllocator
(),
&
q
.
GetAllocator
());
EXPECT_TRUE
(
q
.
IsValid
());
EXPECT_TRUE
(
p
.
IsValid
());
EXPECT_EQ
(
0u
,
q
.
GetTokenCount
());
EXPECT_EQ
(
2u
,
p
.
GetTokenCount
());
EXPECT_EQ
(
3u
,
p
.
GetTokens
()[
0
].
length
);
EXPECT_STREQ
(
"foo"
,
p
.
GetTokens
()[
0
].
name
);
EXPECT_EQ
(
1u
,
p
.
GetTokens
()[
1
].
length
);
EXPECT_STREQ
(
"0"
,
p
.
GetTokens
()[
1
].
name
);
EXPECT_EQ
(
0u
,
p
.
GetTokens
()[
1
].
index
);
std
::
swap
(
p
,
q
);
EXPECT_EQ
(
&
p
.
GetAllocator
(),
&
q
.
GetAllocator
());
EXPECT_TRUE
(
q
.
IsValid
());
EXPECT_TRUE
(
p
.
IsValid
());
EXPECT_EQ
(
0u
,
q
.
GetTokenCount
());
EXPECT_EQ
(
2u
,
p
.
GetTokenCount
());
EXPECT_EQ
(
3u
,
p
.
GetTokens
()[
0
].
length
);
EXPECT_STREQ
(
"foo"
,
p
.
GetTokens
()[
0
].
name
);
EXPECT_EQ
(
1u
,
p
.
GetTokens
()[
1
].
length
);
EXPECT_STREQ
(
"0"
,
p
.
GetTokens
()[
1
].
name
);
EXPECT_EQ
(
0u
,
p
.
GetTokens
()[
1
].
index
);
}
TEST
(
Pointer
,
Append
)
{
...
...
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