Commit 2ce91b82 authored by ylavic's avatar ylavic

Pointer tests now need <algorithm> (for std::swap), but no tabs.

parent a66cf792
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment