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

valuetest: always test comparisons with different allocators

parent 1da07843
...@@ -105,20 +105,12 @@ TEST(Value, equalto_operator) { ...@@ -105,20 +105,12 @@ TEST(Value, equalto_operator) {
TestEqual(x["i"], 123); TestEqual(x["i"], 123);
TestEqual(x["pi"], 3.14); TestEqual(x["pi"], 3.14);
// Test operator==() // Test operator==() (including different allocators)
#ifdef RAPIDJSON_COMPARE_DIFFERENT_ALLOCATORS
CrtAllocator crtAllocator; CrtAllocator crtAllocator;
GenericValue<UTF8<>, CrtAllocator> y; GenericValue<UTF8<>, CrtAllocator> y;
GenericDocument<UTF8<>, CrtAllocator> z(&crtAllocator); GenericDocument<UTF8<>, CrtAllocator> z(&crtAllocator);
CrtAllocator& yAllocator = crtAllocator; y.CopyFrom(x, crtAllocator);
#else
Value::AllocatorType& yAllocator = allocator;
Value y;
Document z;
#endif // RAPIDJSON_COMPARE_DIFFERENT_ALLOCATORS
y.CopyFrom(x, yAllocator);
z.CopyFrom(y, z.GetAllocator()); z.CopyFrom(y, z.GetAllocator());
TestEqual(x, y); TestEqual(x, y);
TestEqual(y, z); TestEqual(y, z);
TestEqual(z, x); TestEqual(z, x);
...@@ -130,7 +122,7 @@ TEST(Value, equalto_operator) { ...@@ -130,7 +122,7 @@ TEST(Value, equalto_operator) {
EXPECT_TRUE(z.RemoveMember("t")); EXPECT_TRUE(z.RemoveMember("t"));
TestUnequal(x, z); TestUnequal(x, z);
TestEqual(y, z); TestEqual(y, z);
y.AddMember("t", true, yAllocator); y.AddMember("t", true, crtAllocator);
z.AddMember("t", true, z.GetAllocator()); z.AddMember("t", true, z.GetAllocator());
TestEqual(x, y); TestEqual(x, y);
TestEqual(y, z); TestEqual(y, z);
......
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