From 8b2faff9818aca4be10589d31088ea1c1bae3bb2 Mon Sep 17 00:00:00 2001 From: Kosta Date: Thu, 4 Sep 2014 15:51:09 +0200 Subject: [PATCH] enhance `IterativeParsingReaderHandler` to check for `Key()` events --- test/unittest/readertest.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/unittest/readertest.cpp b/test/unittest/readertest.cpp index 4c3011c..d7c8edb 100644 --- a/test/unittest/readertest.cpp +++ b/test/unittest/readertest.cpp @@ -819,9 +819,10 @@ struct IterativeParsingReaderHandler { const static int LOG_DOUBLE = -7; const static int LOG_STRING = -8; const static int LOG_STARTOBJECT = -9; - const static int LOG_ENDOBJECT = -10; - const static int LOG_STARTARRAY = -11; - const static int LOG_ENDARRAY = -12; + const static int LOG_KEY = -10; + const static int LOG_ENDOBJECT = -11; + const static int LOG_STARTARRAY = -12; + const static int LOG_ENDARRAY = -13; const static size_t LogCapacity = 256; int Logs[LogCapacity]; @@ -848,7 +849,7 @@ struct IterativeParsingReaderHandler { bool StartObject() { RAPIDJSON_ASSERT(LogCount < LogCapacity); Logs[LogCount++] = LOG_STARTOBJECT; return true; } - bool Key (const Ch* str, SizeType len, bool copy) { return String(str, len, copy); } + bool Key (const Ch* str, SizeType len, bool copy) { RAPIDJSON_ASSERT(LogCount < LogCapacity); Logs[LogCount++] = LOG_KEY; return true; } bool EndObject(SizeType c) { RAPIDJSON_ASSERT(LogCount < LogCapacity); @@ -882,7 +883,7 @@ TEST(Reader, IterativeParsing_General) { handler.LOG_STARTARRAY, handler.LOG_INT, handler.LOG_STARTOBJECT, - handler.LOG_STRING, + handler.LOG_KEY, handler.LOG_STARTARRAY, handler.LOG_INT, handler.LOG_INT, @@ -920,7 +921,7 @@ TEST(Reader, IterativeParsing_Count) { handler.LOG_STARTOBJECT, handler.LOG_ENDOBJECT, 0, handler.LOG_STARTOBJECT, - handler.LOG_STRING, + handler.LOG_KEY, handler.LOG_INT, handler.LOG_ENDOBJECT, 1, handler.LOG_STARTARRAY,