Unverified Commit f5f6052c authored by Milo Yip's avatar Milo Yip Committed by GitHub

Merge pull request #1327 from gongminmin/FixCompileInVS

Fix the compiling problems in VS
parents 08b1a8a4 ff763433
......@@ -76,7 +76,7 @@ TEST_F(Platform, strlen) {
TEST_F(Platform, memcmp) {
for (int i = 0; i < kTrialCount; i++) {
EXPECT_EQ(0, memcmp(temp_, json_, length_));
EXPECT_EQ(0u, memcmp(temp_, json_, length_));
}
}
......
......@@ -38,8 +38,8 @@ TEST(CursorStreamWrapper, MissingFirstBracket) {
size_t col, line;
bool ret = testJson(json, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 3);
EXPECT_EQ(col, 0);
EXPECT_EQ(line, 3u);
EXPECT_EQ(col, 0u);
}
TEST(CursorStreamWrapper, MissingQuotes) {
......@@ -47,8 +47,8 @@ TEST(CursorStreamWrapper, MissingQuotes) {
size_t col, line;
bool ret = testJson(json, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 1);
EXPECT_EQ(col, 8);
EXPECT_EQ(line, 1u);
EXPECT_EQ(col, 8u);
}
TEST(CursorStreamWrapper, MissingColon) {
......@@ -56,8 +56,8 @@ TEST(CursorStreamWrapper, MissingColon) {
size_t col, line;
bool ret = testJson(json, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 3);
EXPECT_EQ(col, 0);
EXPECT_EQ(line, 3u);
EXPECT_EQ(col, 0u);
}
TEST(CursorStreamWrapper, MissingSecondQuotes) {
......@@ -65,8 +65,8 @@ TEST(CursorStreamWrapper, MissingSecondQuotes) {
size_t col, line;
bool ret = testJson(json, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 3);
EXPECT_EQ(col, 1);
EXPECT_EQ(line, 3u);
EXPECT_EQ(col, 1u);
}
TEST(CursorStreamWrapper, MissingComma) {
......@@ -74,8 +74,8 @@ TEST(CursorStreamWrapper, MissingComma) {
size_t col, line;
bool ret = testJson(json, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 3);
EXPECT_EQ(col, 12);
EXPECT_EQ(line, 3u);
EXPECT_EQ(col, 12u);
}
TEST(CursorStreamWrapper, MissingArrayBracket) {
......@@ -83,8 +83,8 @@ TEST(CursorStreamWrapper, MissingArrayBracket) {
size_t col, line;
bool ret = testJson(json, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 4);
EXPECT_EQ(col, 9);
EXPECT_EQ(line, 4u);
EXPECT_EQ(col, 9u);
}
TEST(CursorStreamWrapper, MissingArrayComma) {
......@@ -92,8 +92,8 @@ TEST(CursorStreamWrapper, MissingArrayComma) {
size_t col, line;
bool ret = testJson(json, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 4);
EXPECT_EQ(col, 6);
EXPECT_EQ(line, 4u);
EXPECT_EQ(col, 6u);
}
TEST(CursorStreamWrapper, MissingLastArrayBracket) {
......@@ -101,8 +101,8 @@ TEST(CursorStreamWrapper, MissingLastArrayBracket) {
size_t col, line;
bool ret = testJson(json8, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 4);
EXPECT_EQ(col, 15);
EXPECT_EQ(line, 4u);
EXPECT_EQ(col, 15u);
}
TEST(CursorStreamWrapper, MissingLastBracket) {
......@@ -110,6 +110,6 @@ TEST(CursorStreamWrapper, MissingLastBracket) {
size_t col, line;
bool ret = testJson(json9, line, col);
EXPECT_TRUE(ret);
EXPECT_EQ(line, 4);
EXPECT_EQ(col, 16);
EXPECT_EQ(line, 4u);
EXPECT_EQ(col, 16u);
}
......@@ -35,21 +35,21 @@ static void TestStringStream() {
{
StringStreamType iss;
BasicIStreamWrapper<StringStreamType> is(iss);
EXPECT_EQ(0, is.Tell());
EXPECT_EQ(0u, is.Tell());
if (sizeof(Ch) == 1) {
EXPECT_EQ(0, is.Peek4());
EXPECT_EQ(0, is.Tell());
EXPECT_EQ(0u, is.Tell());
}
EXPECT_EQ(0, is.Peek());
EXPECT_EQ(0, is.Take());
EXPECT_EQ(0, is.Tell());
EXPECT_EQ(0u, is.Tell());
}
{
Ch s[] = { 'A', 'B', 'C', '\0' };
StringStreamType iss(s);
BasicIStreamWrapper<StringStreamType> is(iss);
EXPECT_EQ(0, is.Tell());
EXPECT_EQ(0u, is.Tell());
if (sizeof(Ch) == 1) {
EXPECT_EQ(0, is.Peek4()); // less than 4 bytes
}
......@@ -59,7 +59,7 @@ static void TestStringStream() {
EXPECT_EQ('A' + i, is.Peek());
EXPECT_EQ('A' + i, is.Take());
}
EXPECT_EQ(3, is.Tell());
EXPECT_EQ(3u, is.Tell());
EXPECT_EQ(0, is.Peek());
EXPECT_EQ(0, is.Take());
}
......@@ -72,7 +72,7 @@ static void TestStringStream() {
const Ch* c = is.Peek4();
for (int i = 0; i < 4; i++)
EXPECT_EQ('A' + i, c[i]);
EXPECT_EQ(0, is.Tell());
EXPECT_EQ(0u, is.Tell());
}
for (int i = 0; i < 5; i++) {
EXPECT_EQ(static_cast<size_t>(i), is.Tell());
......@@ -80,7 +80,7 @@ static void TestStringStream() {
EXPECT_EQ('A' + i, is.Peek());
EXPECT_EQ('A' + i, is.Take());
}
EXPECT_EQ(5, is.Tell());
EXPECT_EQ(5u, is.Tell());
EXPECT_EQ(0, is.Peek());
EXPECT_EQ(0, is.Take());
}
......@@ -129,7 +129,7 @@ TEST(IStreamWrapper, ifstream) {
Document d;
EXPECT_TRUE(!d.ParseStream(eis).HasParseError());
EXPECT_TRUE(d.IsObject());
EXPECT_EQ(5, d.MemberCount());
EXPECT_EQ(5u, d.MemberCount());
}
TEST(IStreamWrapper, fstream) {
......@@ -140,7 +140,7 @@ TEST(IStreamWrapper, fstream) {
Document d;
EXPECT_TRUE(!d.ParseStream(eis).HasParseError());
EXPECT_TRUE(d.IsObject());
EXPECT_EQ(5, d.MemberCount());
EXPECT_EQ(5u, d.MemberCount());
}
// wifstream/wfstream only works on C++11 with codecvt_utf16
......
......@@ -634,13 +634,13 @@ TEST(Pointer, Get) {
EXPECT_TRUE(Pointer("/abc").Get(d) == 0);
size_t unresolvedTokenIndex;
EXPECT_TRUE(Pointer("/foo/2").Get(d, &unresolvedTokenIndex) == 0); // Out of boundary
EXPECT_EQ(1, unresolvedTokenIndex);
EXPECT_EQ(1u, unresolvedTokenIndex);
EXPECT_TRUE(Pointer("/foo/a").Get(d, &unresolvedTokenIndex) == 0); // "/foo" is an array, cannot query by "a"
EXPECT_EQ(1, unresolvedTokenIndex);
EXPECT_EQ(1u, unresolvedTokenIndex);
EXPECT_TRUE(Pointer("/foo/0/0").Get(d, &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
EXPECT_EQ(2, unresolvedTokenIndex);
EXPECT_EQ(2u, unresolvedTokenIndex);
EXPECT_TRUE(Pointer("/foo/0/a").Get(d, &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
EXPECT_EQ(2, unresolvedTokenIndex);
EXPECT_EQ(2u, unresolvedTokenIndex);
}
TEST(Pointer, GetWithDefault) {
......@@ -959,13 +959,13 @@ TEST(Pointer, GetValueByPointer) {
size_t unresolvedTokenIndex;
EXPECT_TRUE(GetValueByPointer(d, "/foo/2", &unresolvedTokenIndex) == 0); // Out of boundary
EXPECT_EQ(1, unresolvedTokenIndex);
EXPECT_EQ(1u, unresolvedTokenIndex);
EXPECT_TRUE(GetValueByPointer(d, "/foo/a", &unresolvedTokenIndex) == 0); // "/foo" is an array, cannot query by "a"
EXPECT_EQ(1, unresolvedTokenIndex);
EXPECT_EQ(1u, unresolvedTokenIndex);
EXPECT_TRUE(GetValueByPointer(d, "/foo/0/0", &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
EXPECT_EQ(2, unresolvedTokenIndex);
EXPECT_EQ(2u, unresolvedTokenIndex);
EXPECT_TRUE(GetValueByPointer(d, "/foo/0/a", &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
EXPECT_EQ(2, unresolvedTokenIndex);
EXPECT_EQ(2u, unresolvedTokenIndex);
// const version
const Value& v = d;
......@@ -973,13 +973,13 @@ TEST(Pointer, GetValueByPointer) {
EXPECT_EQ(&d["foo"][0], GetValueByPointer(v, "/foo/0"));
EXPECT_TRUE(GetValueByPointer(v, "/foo/2", &unresolvedTokenIndex) == 0); // Out of boundary
EXPECT_EQ(1, unresolvedTokenIndex);
EXPECT_EQ(1u, unresolvedTokenIndex);
EXPECT_TRUE(GetValueByPointer(v, "/foo/a", &unresolvedTokenIndex) == 0); // "/foo" is an array, cannot query by "a"
EXPECT_EQ(1, unresolvedTokenIndex);
EXPECT_EQ(1u, unresolvedTokenIndex);
EXPECT_TRUE(GetValueByPointer(v, "/foo/0/0", &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
EXPECT_EQ(2, unresolvedTokenIndex);
EXPECT_EQ(2u, unresolvedTokenIndex);
EXPECT_TRUE(GetValueByPointer(v, "/foo/0/a", &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
EXPECT_EQ(2, unresolvedTokenIndex);
EXPECT_EQ(2u, unresolvedTokenIndex);
}
......
This diff is collapsed.
......@@ -41,11 +41,11 @@ TEST(StringBuffer, Put) {
TEST(StringBuffer, PutN_Issue672) {
GenericStringBuffer<UTF8<>, MemoryPoolAllocator<> > buffer;
EXPECT_EQ(0, buffer.GetSize());
EXPECT_EQ(0, buffer.GetLength());
EXPECT_EQ(0u, buffer.GetSize());
EXPECT_EQ(0u, buffer.GetLength());
rapidjson::PutN(buffer, ' ', 1);
EXPECT_EQ(1, buffer.GetSize());
EXPECT_EQ(1, buffer.GetLength());
EXPECT_EQ(1u, buffer.GetSize());
EXPECT_EQ(1u, buffer.GetLength());
}
TEST(StringBuffer, Clear) {
......
......@@ -26,11 +26,11 @@ using namespace rapidjson;
TEST(Value, Size) {
if (sizeof(SizeType) == 4) {
#if RAPIDJSON_48BITPOINTER_OPTIMIZATION
EXPECT_EQ(16, sizeof(Value));
EXPECT_EQ(16u, sizeof(Value));
#elif RAPIDJSON_64BIT
EXPECT_EQ(24, sizeof(Value));
EXPECT_EQ(24u, sizeof(Value));
#else
EXPECT_EQ(16, sizeof(Value));
EXPECT_EQ(16u, sizeof(Value));
#endif
}
}
......@@ -1135,10 +1135,10 @@ TEST(Value, ArrayHelper) {
a.PushBack(1, allocator);
Value::Array a2(a); // copy constructor
EXPECT_EQ(1, a2.Size());
EXPECT_EQ(1u, a2.Size());
Value::Array a3 = a;
EXPECT_EQ(1, a3.Size());
EXPECT_EQ(1u, a3.Size());
Value::ConstArray y = static_cast<const Value&>(x).GetArray();
(void)y;
......@@ -1175,7 +1175,7 @@ TEST(Value, ArrayHelper) {
y.PushBack(123, allocator);
x.PushBack(y.GetArray(), allocator); // Implicit constructor to convert Array to GenericValue
EXPECT_EQ(1, x.Size());
EXPECT_EQ(1u, x.Size());
EXPECT_EQ(123, x[0][0].GetInt());
EXPECT_TRUE(y.IsArray());
EXPECT_TRUE(y.Empty());
......@@ -1424,7 +1424,7 @@ static void TestObject(T& x, Allocator& allocator) {
for (; itr != x.MemberEnd(); ++itr) {
size_t i = static_cast<size_t>((itr - x.MemberBegin())) + 1;
EXPECT_STREQ(itr->name.GetString(), keys[i]);
EXPECT_EQ(i, itr->value[0].GetInt());
EXPECT_EQ(static_cast<int>(i), itr->value[0].GetInt());
}
// Erase the last
......@@ -1435,7 +1435,7 @@ static void TestObject(T& x, Allocator& allocator) {
for (; itr != x.MemberEnd(); ++itr) {
size_t i = static_cast<size_t>(itr - x.MemberBegin()) + 1;
EXPECT_STREQ(itr->name.GetString(), keys[i]);
EXPECT_EQ(i, itr->value[0].GetInt());
EXPECT_EQ(static_cast<int>(i), itr->value[0].GetInt());
}
// Erase the middle
......@@ -1447,7 +1447,7 @@ static void TestObject(T& x, Allocator& allocator) {
size_t i = static_cast<size_t>(itr - x.MemberBegin());
i += (i < 4) ? 1 : 2;
EXPECT_STREQ(itr->name.GetString(), keys[i]);
EXPECT_EQ(i, itr->value[0].GetInt());
EXPECT_EQ(static_cast<int>(i), itr->value[0].GetInt());
}
// EraseMember(ConstMemberIterator, ConstMemberIterator)
......@@ -1516,10 +1516,10 @@ TEST(Value, ObjectHelper) {
o.AddMember("1", 1, allocator);
Value::Object o2(o); // copy constructor
EXPECT_EQ(1, o2.MemberCount());
EXPECT_EQ(1u, o2.MemberCount());
Value::Object o3 = o;
EXPECT_EQ(1, o3.MemberCount());
EXPECT_EQ(1u, o3.MemberCount());
Value::ConstObject y = static_cast<const Value&>(x).GetObject();
(void)y;
......
Subproject commit 0a439623f75c029912728d80cb7f1b8b48739ca4
Subproject commit ba96d0b1161f540656efdaed035b3c062b60e006
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