Commit 8c258405 authored by Milo Yip's avatar Milo Yip

Fix Document.UserBuffer test

parent 544e26c1
...@@ -238,10 +238,10 @@ TEST(Document, AcceptWriter) { ...@@ -238,10 +238,10 @@ TEST(Document, AcceptWriter) {
TEST(Document, UserBuffer) { TEST(Document, UserBuffer) {
typedef GenericDocument<UTF8<>, MemoryPoolAllocator<>, MemoryPoolAllocator<> > DocumentType; typedef GenericDocument<UTF8<>, MemoryPoolAllocator<>, MemoryPoolAllocator<> > DocumentType;
char valueBuffer[4096]; char valueBuffer[4096];
char parseBuffer[2048]; char parseBuffer[1024];
MemoryPoolAllocator<> valueAllocator(valueBuffer, sizeof(valueBuffer)); MemoryPoolAllocator<> valueAllocator(valueBuffer, sizeof(valueBuffer));
MemoryPoolAllocator<> parseAllocator(parseBuffer, sizeof(parseBuffer)); MemoryPoolAllocator<> parseAllocator(parseBuffer, sizeof(parseBuffer));
DocumentType doc(&valueAllocator, sizeof(parseBuffer), &parseAllocator); DocumentType doc(&valueAllocator, sizeof(parseBuffer) / 2, &parseAllocator);
doc.Parse(" { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null, \"i\":123, \"pi\": 3.1416, \"a\":[1, 2, 3, 4] } "); doc.Parse(" { \"hello\" : \"world\", \"t\" : true , \"f\" : false, \"n\": null, \"i\":123, \"pi\": 3.1416, \"a\":[1, 2, 3, 4] } ");
EXPECT_FALSE(doc.HasParseError()); EXPECT_FALSE(doc.HasParseError());
EXPECT_LE(valueAllocator.Size(), sizeof(valueBuffer)); EXPECT_LE(valueAllocator.Size(), sizeof(valueBuffer));
......
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