Commit d63a40a0 authored by Philipp A. Hartmann's avatar Philipp A. Hartmann

valuetest: extended value comparison tests

Prepare equalto_operator tests to test comparisons between
 * GenericValue and GenericDocument
 * GenericValue with different SourceAllocator types

Both combinations currently fail due to ambiguities with the
templated operators on several compilers.
parent a9add7bd
......@@ -106,15 +106,35 @@ TEST(Value, equalto_operator) {
TestEqual(x["pi"], 3.14);
// Test operator==()
#ifdef RAPIDJSON_COMPARE_DIFFERENT_ALLOCATORS
CrtAllocator crtAllocator;
GenericValue<UTF8<>, CrtAllocator> y;
GenericDocument<UTF8<>, CrtAllocator> z(&crtAllocator);
CrtAllocator& yAllocator = crtAllocator;
#else
Value::AllocatorType& yAllocator = allocator;
Value y;
y.CopyFrom(x, allocator);
Document z;
#endif // RAPIDJSON_COMPARE_DIFFERENT_ALLOCATORS
y.CopyFrom(x, yAllocator);
z.CopyFrom(y, z.GetAllocator());
TestEqual(x, y);
TestEqual(y, z);
TestEqual(z, x);
// Swapping member order should be fine.
y.RemoveMember("t");
EXPECT_TRUE(y.RemoveMember("t"));
TestUnequal(x, y);
y.AddMember("t", Value(true).Move(), allocator);
TestUnequal(z, y);
EXPECT_TRUE(z.RemoveMember("t"));
TestUnequal(x, z);
TestEqual(y, z);
y.AddMember("t", true, yAllocator);
z.AddMember("t", true, z.GetAllocator());
TestEqual(x, y);
TestEqual(y, z);
TestEqual(z, x);
}
template <typename Value>
......
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