Unverified Commit 8a96a95d authored by Milo Yip's avatar Milo Yip Committed by GitHub

Merge branch 'master' into fix-noexcept

parents f54f6b5a f5f6052c
......@@ -92,26 +92,26 @@ public:
*/
//@{
bool Null() { PrettyPrefix(kNullType); return Base::WriteNull(); }
bool Bool(bool b) { PrettyPrefix(b ? kTrueType : kFalseType); return Base::WriteBool(b); }
bool Int(int i) { PrettyPrefix(kNumberType); return Base::WriteInt(i); }
bool Uint(unsigned u) { PrettyPrefix(kNumberType); return Base::WriteUint(u); }
bool Int64(int64_t i64) { PrettyPrefix(kNumberType); return Base::WriteInt64(i64); }
bool Uint64(uint64_t u64) { PrettyPrefix(kNumberType); return Base::WriteUint64(u64); }
bool Double(double d) { PrettyPrefix(kNumberType); return Base::WriteDouble(d); }
bool Null() { PrettyPrefix(kNullType); return Base::EndValue(Base::WriteNull()); }
bool Bool(bool b) { PrettyPrefix(b ? kTrueType : kFalseType); return Base::EndValue(Base::WriteBool(b)); }
bool Int(int i) { PrettyPrefix(kNumberType); return Base::EndValue(Base::WriteInt(i)); }
bool Uint(unsigned u) { PrettyPrefix(kNumberType); return Base::EndValue(Base::WriteUint(u)); }
bool Int64(int64_t i64) { PrettyPrefix(kNumberType); return Base::EndValue(Base::WriteInt64(i64)); }
bool Uint64(uint64_t u64) { PrettyPrefix(kNumberType); return Base::EndValue(Base::WriteUint64(u64)); }
bool Double(double d) { PrettyPrefix(kNumberType); return Base::EndValue(Base::WriteDouble(d)); }
bool RawNumber(const Ch* str, SizeType length, bool copy = false) {
RAPIDJSON_ASSERT(str != 0);
(void)copy;
PrettyPrefix(kNumberType);
return Base::WriteString(str, length);
return Base::EndValue(Base::WriteString(str, length));
}
bool String(const Ch* str, SizeType length, bool copy = false) {
RAPIDJSON_ASSERT(str != 0);
(void)copy;
PrettyPrefix(kStringType);
return Base::WriteString(str, length);
return Base::EndValue(Base::WriteString(str, length));
}
#if RAPIDJSON_HAS_STDSTRING
......@@ -146,7 +146,7 @@ public:
Base::os_->Put('\n');
WriteIndent();
}
bool ret = Base::WriteEndObject();
bool ret = Base::EndValue(Base::WriteEndObject());
(void)ret;
RAPIDJSON_ASSERT(ret == true);
if (Base::level_stack_.Empty()) // end of json text
......@@ -170,7 +170,7 @@ public:
Base::os_->Put('\n');
WriteIndent();
}
bool ret = Base::WriteEndArray();
bool ret = Base::EndValue(Base::WriteEndArray());
(void)ret;
RAPIDJSON_ASSERT(ret == true);
if (Base::level_stack_.Empty()) // end of json text
......@@ -201,7 +201,7 @@ public:
bool RawValue(const Ch* json, size_t length, Type type) {
RAPIDJSON_ASSERT(json != 0);
PrettyPrefix(type);
return Base::WriteRawValue(json, length);
return Base::EndValue(Base::WriteRawValue(json, length));
}
protected:
......
......@@ -269,16 +269,11 @@
/*! \ingroup RAPIDJSON_CONFIG
\param x pointer to align
Some machines require strict data alignment. Currently the default uses 4 bytes
alignment on 32-bit platforms and 8 bytes alignment for 64-bit platforms.
Some machines require strict data alignment. The default is 8 bytes.
User can customize by defining the RAPIDJSON_ALIGN function macro.
*/
#ifndef RAPIDJSON_ALIGN
#if RAPIDJSON_64BIT == 1
#define RAPIDJSON_ALIGN(x) (((x) + static_cast<uint64_t>(7u)) & ~static_cast<uint64_t>(7u))
#else
#define RAPIDJSON_ALIGN(x) (((x) + 3u) & ~3u)
#endif
#define RAPIDJSON_ALIGN(x) (((x) + static_cast<size_t>(7u)) & ~static_cast<size_t>(7u))
#endif
///////////////////////////////////////////////////////////////////////////////
......@@ -617,6 +612,19 @@ RAPIDJSON_NAMESPACE_END
#endif // RAPIDJSON_HAS_CXX11_NOEXCEPT
#endif // RAPIDJSON_NOEXCEPT_ASSERT
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_NOEXCEPT_ASSERT
#ifdef RAPIDJSON_ASSERT_THROWS
#if RAPIDJSON_HAS_CXX11_NOEXCEPT
#define RAPIDJSON_NOEXCEPT_ASSERT(x)
#else
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x)
#endif // RAPIDJSON_HAS_CXX11_NOEXCEPT
#else
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x)
#endif // RAPIDJSON_ASSERT_THROWS
///////////////////////////////////////////////////////////////////////////////
// new/delete
......
......@@ -606,7 +606,7 @@ public:
parseResult_.Clear();
state_ = IterativeParsingStartState;
}
//! Parse one token from JSON text
/*! \tparam InputStream Type of input stream, implementing Stream concept
\tparam Handler Type of handler, implementing Handler concept.
......@@ -618,11 +618,11 @@ public:
bool IterativeParseNext(InputStream& is, Handler& handler) {
while (RAPIDJSON_LIKELY(is.Peek() != '\0')) {
SkipWhitespaceAndComments<parseFlags>(is);
Token t = Tokenize(is.Peek());
IterativeParsingState n = Predict(state_, t);
IterativeParsingState d = Transit<parseFlags>(state_, t, n, is, handler);
// If we've finished or hit an error...
if (RAPIDJSON_UNLIKELY(IsIterativeParsingCompleteState(d))) {
// Report errors.
......@@ -630,11 +630,11 @@ public:
HandleError(state_, is);
return false;
}
// Transition to the finish state.
RAPIDJSON_ASSERT(d == IterativeParsingFinishState);
state_ = d;
// If StopWhenDone is not set...
if (!(parseFlags & kParseStopWhenDoneFlag)) {
// ... and extra non-whitespace data is found...
......@@ -645,11 +645,11 @@ public:
return false;
}
}
// Success! We are done!
return true;
}
// Transition to the new state.
state_ = d;
......@@ -657,7 +657,7 @@ public:
if (!IsIterativeParsingDelimiterState(n))
return true;
}
// We reached the end of file.
stack_.Clear();
......@@ -665,10 +665,10 @@ public:
HandleError(state_, is);
return false;
}
return true;
}
//! Check if token-by-token parsing JSON text is complete
/*! \return Whether the JSON has been fully decoded.
*/
......@@ -1523,7 +1523,7 @@ private:
}
}
}
if (RAPIDJSON_UNLIKELY(!useNanOrInf)) {
RAPIDJSON_PARSE_ERROR(kParseErrorValueInvalid, s.Tell());
}
......@@ -1701,7 +1701,7 @@ private:
d = internal::StrtodNormalPrecision(d, p);
// Use > max, instead of == inf, to fix bogus warning -Wfloat-equal
if (d > std::numeric_limits<double>::max()) {
if (d > (std::numeric_limits<double>::max)()) {
// Overflow
// TODO: internal::StrtodX should report overflow (or underflow)
RAPIDJSON_PARSE_ERROR(kParseErrorNumberTooBig, startOffset);
......@@ -1769,12 +1769,12 @@ private:
// Single value state
IterativeParsingValueState,
// Delimiter states (at bottom)
IterativeParsingElementDelimiterState,
IterativeParsingMemberDelimiterState,
IterativeParsingKeyValueDelimiterState,
cIterativeParsingStateCount
};
......@@ -2167,43 +2167,43 @@ private:
RAPIDJSON_FORCEINLINE bool IsIterativeParsingDelimiterState(IterativeParsingState s) const {
return s >= IterativeParsingElementDelimiterState;
}
RAPIDJSON_FORCEINLINE bool IsIterativeParsingCompleteState(IterativeParsingState s) const {
return s <= IterativeParsingErrorState;
}
template <unsigned parseFlags, typename InputStream, typename Handler>
ParseResult IterativeParse(InputStream& is, Handler& handler) {
parseResult_.Clear();
ClearStackOnExit scope(*this);
IterativeParsingState state = IterativeParsingStartState;
SkipWhitespaceAndComments<parseFlags>(is);
RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_);
while (is.Peek() != '\0') {
Token t = Tokenize(is.Peek());
IterativeParsingState n = Predict(state, t);
IterativeParsingState d = Transit<parseFlags>(state, t, n, is, handler);
if (d == IterativeParsingErrorState) {
HandleError(state, is);
break;
}
state = d;
// Do not further consume streams if a root JSON has been parsed.
if ((parseFlags & kParseStopWhenDoneFlag) && state == IterativeParsingFinishState)
break;
SkipWhitespaceAndComments<parseFlags>(is);
RAPIDJSON_PARSE_ERROR_EARLY_RETURN(parseResult_);
}
// Handle the end of file.
if (state != IterativeParsingFinishState)
HandleError(state, is);
return parseResult_;
}
......
......@@ -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_));
}
}
......
......@@ -63,23 +63,21 @@ TEST(Allocator, MemoryPoolAllocator) {
}
TEST(Allocator, Alignment) {
#if RAPIDJSON_64BIT == 1
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000000, 0x00000000), RAPIDJSON_ALIGN(0));
for (uint64_t i = 1; i < 8; i++) {
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000000, 0x00000008), RAPIDJSON_ALIGN(i));
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000000, 0x00000010), RAPIDJSON_ALIGN(RAPIDJSON_UINT64_C2(0x00000000, 0x00000008) + i));
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000001, 0x00000000), RAPIDJSON_ALIGN(RAPIDJSON_UINT64_C2(0x00000000, 0xFFFFFFF8) + i));
EXPECT_EQ(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0xFFFFFFF8), RAPIDJSON_ALIGN(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0xFFFFFFF0) + i));
if (sizeof(size_t) >= 8) {
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000000, 0x00000000), RAPIDJSON_ALIGN(0));
for (uint64_t i = 1; i < 8; i++) {
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000000, 0x00000008), RAPIDJSON_ALIGN(i));
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000000, 0x00000010), RAPIDJSON_ALIGN(RAPIDJSON_UINT64_C2(0x00000000, 0x00000008) + i));
EXPECT_EQ(RAPIDJSON_UINT64_C2(0x00000001, 0x00000000), RAPIDJSON_ALIGN(RAPIDJSON_UINT64_C2(0x00000000, 0xFFFFFFF8) + i));
EXPECT_EQ(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0xFFFFFFF8), RAPIDJSON_ALIGN(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0xFFFFFFF0) + i));
}
}
#else
EXPECT_EQ(0u, RAPIDJSON_ALIGN(0u));
for (uint32_t i = 1; i < 4; i++) {
EXPECT_EQ(4u, RAPIDJSON_ALIGN(i));
EXPECT_EQ(8u, RAPIDJSON_ALIGN(4u + i));
EXPECT_EQ(0xFFFFFFF8u, RAPIDJSON_ALIGN(0xFFFFFFF4u + i));
EXPECT_EQ(0xFFFFFFFCu, RAPIDJSON_ALIGN(0xFFFFFFF8u + i));
for (uint32_t i = 1; i < 8; i++) {
EXPECT_EQ(8u, RAPIDJSON_ALIGN(i));
EXPECT_EQ(0xFFFFFFF8u, RAPIDJSON_ALIGN(0xFFFFFFF0u + i));
}
#endif
}
TEST(Allocator, Issue399) {
......
......@@ -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
......
// Tencent is pleased to support the open source community by making RapidJSON available.
//
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
......@@ -7,9 +7,9 @@
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#include "unittest.h"
......@@ -61,7 +61,7 @@ static void VerifyValue(T value, void(*f)(T, char*), char* (*g)(T, char*)) {
f(value, buffer1);
*g(value, buffer2) = '\0';
EXPECT_STREQ(buffer1, buffer2);
}
......@@ -79,12 +79,12 @@ static void Verify(void(*f)(T, char*), char* (*g)(T, char*)) {
do {
VerifyValue<T>(i - 1, f, g);
VerifyValue<T>(i, f, g);
if (std::numeric_limits<T>::min() < 0) {
if ((std::numeric_limits<T>::min)() < 0) {
VerifyValue<T>(Traits<T>::Negate(i), f, g);
VerifyValue<T>(Traits<T>::Negate(i + 1), f, g);
}
last = i;
if (i > static_cast<T>(std::numeric_limits<T>::max() / static_cast<T>(power)))
if (i > static_cast<T>((std::numeric_limits<T>::max)() / static_cast<T>(power)))
break;
i *= static_cast<T>(power);
} while (last < i);
......
......@@ -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);
}
......
......@@ -339,6 +339,35 @@ TEST(PrettyWriter, MoveCtor) {
}
#endif
TEST(PrettyWriter, Issue_1336) {
#define T(meth, val, expected) \
{ \
StringBuffer buffer; \
PrettyWriter<StringBuffer> writer(buffer); \
writer.meth(val); \
\
EXPECT_STREQ(expected, buffer.GetString()); \
EXPECT_TRUE(writer.IsComplete()); \
}
T(Bool, false, "false");
T(Bool, true, "true");
T(Int, 0, "0");
T(Uint, 0, "0");
T(Int64, 0, "0");
T(Uint64, 0, "0");
T(Double, 0, "0.0");
T(String, "Hello", "\"Hello\"");
#undef T
StringBuffer buffer;
PrettyWriter<StringBuffer> writer(buffer);
writer.Null();
EXPECT_STREQ("null", buffer.GetString());
EXPECT_TRUE(writer.IsComplete());
}
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
......@@ -422,7 +422,7 @@ static void TestParseDouble() {
"67546703537516986049910576551282076245490090389328944075868508455133942"
"30458323690322294816580855933212334827479782620414472316873817718091929"
"9881250404026184124858368",
std::numeric_limits<double>::max());
(std::numeric_limits<double>::max)());
TEST_DOUBLE(fullPrecision,
"243546080556034731077856379609316893158278902575447060151047"
......@@ -649,43 +649,43 @@ static void TestParseNumberError() {
for (int i = 1; i < 310; i++)
n1e309[i] = '0';
n1e309[310] = '\0';
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, n1e309, 0, 310);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, n1e309, 0u, 310u);
}
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e309", 0, 5);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e309", 0u, 5u);
// Miss fraction part in number.
TEST_NUMBER_ERROR(kParseErrorNumberMissFraction, "1.", 2, 2);
TEST_NUMBER_ERROR(kParseErrorNumberMissFraction, "1.a", 2, 2);
TEST_NUMBER_ERROR(kParseErrorNumberMissFraction, "1.", 2u, 2u);
TEST_NUMBER_ERROR(kParseErrorNumberMissFraction, "1.a", 2u, 2u);
// Miss exponent in number.
TEST_NUMBER_ERROR(kParseErrorNumberMissExponent, "1e", 2, 2);
TEST_NUMBER_ERROR(kParseErrorNumberMissExponent, "1e_", 2, 2);
TEST_NUMBER_ERROR(kParseErrorNumberMissExponent, "1e", 2u, 2u);
TEST_NUMBER_ERROR(kParseErrorNumberMissExponent, "1e_", 2u, 2u);
// Issue 849
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1.8e308", 0, 7);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "5e308", 0, 5);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e309", 0, 5);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1.0e310", 0, 7);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1.00e310", 0, 8);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "-1.8e308", 0, 8);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "-1e309", 0, 6);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1.8e308", 0u, 7u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "5e308", 0u, 5u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e309", 0u, 5u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1.0e310", 0u, 7u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1.00e310", 0u, 8u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "-1.8e308", 0u, 8u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "-1e309", 0u, 6u);
// Issue 1253
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "2e308", 0, 5);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "2e308", 0u, 5u);
// Issue 1259
TEST_NUMBER_ERROR(kParseErrorNumberTooBig,
"88474320368547737236837236775298547354737253685475547552933720368546854775297525"
"29337203685468547770151233720097201372368547312337203687203685423685123372036872"
"03685473724737236837236775297525854775297525472975254737236873720170151235473783"
"7236737247372368772473723683723456789012E66", 0, 283);
"7236737247372368772473723683723456789012E66", 0u, 283u);
#if 0
// Test (length + exponent) overflow
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+2147483647", 0, 13);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+9223372036854775807", 0, 22);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+10000", 0, 8);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+50000", 0, 8);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+2147483647", 0u, 13u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+9223372036854775807", 0u, 22u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+10000", 0u, 8u);
TEST_NUMBER_ERROR(kParseErrorNumberTooBig, "1e+50000", 0u, 8u);
#endif
// 9007199254740992 * 2^971 ("infinity")
......@@ -693,7 +693,7 @@ static void TestParseNumberError() {
"1.797693134862315907729305190789024733617976978942306572734300811577326758055009"
"63132708477322407536021120113879871393357658789768814416622492847430639474124377"
"76789342486548527630221960124609411945308295208500576883815068234246288147391311"
"0540827237163350510684586298239947245938479716304835356329624224137216e+308", 0, 315);
"0540827237163350510684586298239947245938479716304835356329624224137216e+308", 0u, 315u);
// TODO:
// These tests (currently) fail in normal-precision mode
......@@ -715,7 +715,7 @@ static void TestParseNumberError() {
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000e+308", 0, 1125);
"00000000000000000000000000000000000000000000000000000000000000000000000000000000e+308", 0u, 1125u);
// ...round up
TEST_NUMBER_ERROR(kParseErrorNumberTooBig,
"1.797693134862315807937289714053034150799341327100378269361737789804449682927647"
......@@ -732,14 +732,14 @@ static void TestParseNumberError() {
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000001e+308", 0, 1205);
"00000000000000000000000000000000000000000000000000000000000000000000000000000001e+308", 0u, 1205u);
}
TEST_NUMBER_ERROR(kParseErrorNumberTooBig,
"10000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000000000001", 0, 310);
"0000000000000000000000000000000000000000000000000000000000000000000001", 0u, 310u);
#undef TEST_NUMBER_ERROR
}
......@@ -931,21 +931,21 @@ TEST(Reader, ParseString_Error) {
}
// Invalid escape character in string.
TEST_STRING_ERROR(kParseErrorStringEscapeInvalid, "[\"\\a\"]", 2, 3);
TEST_STRING_ERROR(kParseErrorStringEscapeInvalid, "[\"\\a\"]", 2u, 3u);
// Incorrect hex digit after \\u escape in string.
TEST_STRING_ERROR(kParseErrorStringUnicodeEscapeInvalidHex, "[\"\\uABCG\"]", 2, 7);
TEST_STRING_ERROR(kParseErrorStringUnicodeEscapeInvalidHex, "[\"\\uABCG\"]", 2u, 7u);
// Quotation in \\u escape in string (Issue #288)
TEST_STRING_ERROR(kParseErrorStringUnicodeEscapeInvalidHex, "[\"\\uaaa\"]", 2, 7);
TEST_STRING_ERROR(kParseErrorStringUnicodeEscapeInvalidHex, "[\"\\uD800\\uFFF\"]", 2, 13);
TEST_STRING_ERROR(kParseErrorStringUnicodeEscapeInvalidHex, "[\"\\uaaa\"]", 2u, 7u);
TEST_STRING_ERROR(kParseErrorStringUnicodeEscapeInvalidHex, "[\"\\uD800\\uFFF\"]", 2u, 13u);
// The surrogate pair in string is invalid.
TEST_STRING_ERROR(kParseErrorStringUnicodeSurrogateInvalid, "[\"\\uD800X\"]", 2, 8);
TEST_STRING_ERROR(kParseErrorStringUnicodeSurrogateInvalid, "[\"\\uD800\\uFFFF\"]", 2, 14);
TEST_STRING_ERROR(kParseErrorStringUnicodeSurrogateInvalid, "[\"\\uD800X\"]", 2u, 8u);
TEST_STRING_ERROR(kParseErrorStringUnicodeSurrogateInvalid, "[\"\\uD800\\uFFFF\"]", 2u, 14u);
// Missing a closing quotation mark in string.
TEST_STRING_ERROR(kParseErrorStringMissQuotationMark, "[\"Test]", 7, 7);
TEST_STRING_ERROR(kParseErrorStringMissQuotationMark, "[\"Test]", 7u, 7u);
// http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
......@@ -968,7 +968,7 @@ TEST(Reader, ParseString_Error) {
char e[] = { '[', '\"', 0, ' ', '\"', ']', '\0' };
for (unsigned c = 0xC0u; c <= 0xFFu; c++) {
e[2] = static_cast<char>(c);
int streamPos;
unsigned streamPos;
if (c <= 0xC1u)
streamPos = 3; // 0xC0 - 0xC1
else if (c <= 0xDFu)
......@@ -979,7 +979,7 @@ TEST(Reader, ParseString_Error) {
streamPos = 6; // 0xF0 - 0xF4
else
streamPos = 3; // 0xF5 - 0xFF
TEST_STRING_ERROR(kParseErrorStringInvalidEncoding, e, 2, streamPos);
TEST_STRING_ERROR(kParseErrorStringInvalidEncoding, e, 2u, streamPos);
}
}
......@@ -1062,7 +1062,7 @@ TEST(Reader, ParseArray) {
TEST(Reader, ParseArray_Error) {
#define TEST_ARRAY_ERROR(errorCode, str, errorOffset) \
{ \
int streamPos = errorOffset; \
unsigned streamPos = errorOffset; \
char buffer[1001]; \
strncpy(buffer, str, 1000); \
InsituStringStream s(buffer); \
......@@ -1075,13 +1075,13 @@ TEST(Reader, ParseArray_Error) {
}
// Missing a comma or ']' after an array element.
TEST_ARRAY_ERROR(kParseErrorArrayMissCommaOrSquareBracket, "[1", 2);
TEST_ARRAY_ERROR(kParseErrorArrayMissCommaOrSquareBracket, "[1}", 2);
TEST_ARRAY_ERROR(kParseErrorArrayMissCommaOrSquareBracket, "[1 2]", 3);
TEST_ARRAY_ERROR(kParseErrorArrayMissCommaOrSquareBracket, "[1", 2u);
TEST_ARRAY_ERROR(kParseErrorArrayMissCommaOrSquareBracket, "[1}", 2u);
TEST_ARRAY_ERROR(kParseErrorArrayMissCommaOrSquareBracket, "[1 2]", 3u);
// Array cannot have a trailing comma (without kParseTrailingCommasFlag);
// a value must follow a comma
TEST_ARRAY_ERROR(kParseErrorValueInvalid, "[1,]", 3);
TEST_ARRAY_ERROR(kParseErrorValueInvalid, "[1,]", 3u);
#undef TEST_ARRAY_ERROR
}
......@@ -1230,7 +1230,7 @@ TEST(Reader, ParseInsituIterative_MultipleRoot) {
#define TEST_ERROR(errorCode, str, errorOffset) \
{ \
int streamPos = errorOffset; \
unsigned streamPos = errorOffset; \
char buffer[1001]; \
strncpy(buffer, str, 1000); \
InsituStringStream s(buffer); \
......@@ -1244,48 +1244,48 @@ TEST(Reader, ParseInsituIterative_MultipleRoot) {
TEST(Reader, ParseDocument_Error) {
// The document is empty.
TEST_ERROR(kParseErrorDocumentEmpty, "", 0);
TEST_ERROR(kParseErrorDocumentEmpty, " ", 1);
TEST_ERROR(kParseErrorDocumentEmpty, " \n", 2);
TEST_ERROR(kParseErrorDocumentEmpty, "", 0u);
TEST_ERROR(kParseErrorDocumentEmpty, " ", 1u);
TEST_ERROR(kParseErrorDocumentEmpty, " \n", 2u);
// The document root must not follow by other values.
TEST_ERROR(kParseErrorDocumentRootNotSingular, "[] 0", 3);
TEST_ERROR(kParseErrorDocumentRootNotSingular, "{} 0", 3);
TEST_ERROR(kParseErrorDocumentRootNotSingular, "null []", 5);
TEST_ERROR(kParseErrorDocumentRootNotSingular, "0 {}", 2);
TEST_ERROR(kParseErrorDocumentRootNotSingular, "[] 0", 3u);
TEST_ERROR(kParseErrorDocumentRootNotSingular, "{} 0", 3u);
TEST_ERROR(kParseErrorDocumentRootNotSingular, "null []", 5u);
TEST_ERROR(kParseErrorDocumentRootNotSingular, "0 {}", 2u);
}
TEST(Reader, ParseValue_Error) {
// Invalid value.
TEST_ERROR(kParseErrorValueInvalid, "nulL", 3);
TEST_ERROR(kParseErrorValueInvalid, "truE", 3);
TEST_ERROR(kParseErrorValueInvalid, "falsE", 4);
TEST_ERROR(kParseErrorValueInvalid, "a]", 0);
TEST_ERROR(kParseErrorValueInvalid, ".1", 0);
TEST_ERROR(kParseErrorValueInvalid, "nulL", 3u);
TEST_ERROR(kParseErrorValueInvalid, "truE", 3u);
TEST_ERROR(kParseErrorValueInvalid, "falsE", 4u);
TEST_ERROR(kParseErrorValueInvalid, "a]", 0u);
TEST_ERROR(kParseErrorValueInvalid, ".1", 0u);
}
TEST(Reader, ParseObject_Error) {
// Missing a name for object member.
TEST_ERROR(kParseErrorObjectMissName, "{1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{null:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{true:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{false:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{1:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{[]:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{{}:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{xyz:1}", 1);
TEST_ERROR(kParseErrorObjectMissName, "{1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{:1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{null:1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{true:1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{false:1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{1:1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{[]:1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{{}:1}", 1u);
TEST_ERROR(kParseErrorObjectMissName, "{xyz:1}", 1u);
// Missing a colon after a name of object member.
TEST_ERROR(kParseErrorObjectMissColon, "{\"a\" 1}", 5);
TEST_ERROR(kParseErrorObjectMissColon, "{\"a\",1}", 4);
TEST_ERROR(kParseErrorObjectMissColon, "{\"a\" 1}", 5u);
TEST_ERROR(kParseErrorObjectMissColon, "{\"a\",1}", 4u);
// Must be a comma or '}' after an object member
TEST_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, "{\"a\":1]", 6);
TEST_ERROR(kParseErrorObjectMissCommaOrCurlyBracket, "{\"a\":1]", 6u);
// Object cannot have a trailing comma (without kParseTrailingCommasFlag);
// an object member name must follow a comma
TEST_ERROR(kParseErrorObjectMissName, "{\"a\":1,}", 7);
TEST_ERROR(kParseErrorObjectMissName, "{\"a\":1,}", 7u);
// This tests that MemoryStream is checking the length in Peek().
{
......@@ -1405,7 +1405,7 @@ TEST(Reader, Parse_IStreamWrapper_StringStream) {
#define TESTERRORHANDLING(text, errorCode, offset)\
{\
int streamPos = offset; \
unsigned streamPos = offset; \
StringStream json(text); \
BaseReaderHandler<> handler; \
Reader reader; \
......@@ -2153,7 +2153,7 @@ TEST(Reader, ParseNanAndInfinity) {
}
#define TEST_NAN_INF_ERROR(errorCode, str, errorOffset) \
{ \
int streamPos = errorOffset; \
unsigned streamPos = errorOffset; \
char buffer[1001]; \
strncpy(buffer, str, 1000); \
InsituStringStream s(buffer); \
......@@ -2174,14 +2174,14 @@ TEST(Reader, ParseNanAndInfinity) {
TEST_NAN_INF("Infinity", inf);
TEST_NAN_INF("-Inf", -inf);
TEST_NAN_INF("-Infinity", -inf);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "NInf", 1);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "NaInf", 2);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "INan", 1);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "InNan", 2);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "nan", 1);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "-nan", 1);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "NAN", 1);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "-Infinty", 6);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "NInf", 1u);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "NaInf", 2u);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "INan", 1u);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "InNan", 2u);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "nan", 1u);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "-nan", 1u);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "NAN", 1u);
TEST_NAN_INF_ERROR(kParseErrorValueInvalid, "-Infinty", 6u);
#undef TEST_NAN_INF_ERROR
#undef TEST_NAN_INF
......
......@@ -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