Commit 7c72640d authored by Milo Yip's avatar Milo Yip

Improve reader coverage for insitu parsing

parent cefae77a
...@@ -80,7 +80,7 @@ struct ScanCopyUnescapedStringHandler : BaseReaderHandler<UTF8<>, ScanCopyUnesca ...@@ -80,7 +80,7 @@ struct ScanCopyUnescapedStringHandler : BaseReaderHandler<UTF8<>, ScanCopyUnesca
char buffer[1024 + 5]; char buffer[1024 + 5];
}; };
template <typename StreamType> template <unsigned parseFlags, typename StreamType>
void TestScanCopyUnescapedString() { void TestScanCopyUnescapedString() {
for (size_t step = 0; step < 1024; step++) { for (size_t step = 0; step < 1024; step++) {
char json[1024 + 5]; char json[1024 + 5];
...@@ -96,7 +96,7 @@ void TestScanCopyUnescapedString() { ...@@ -96,7 +96,7 @@ void TestScanCopyUnescapedString() {
StreamType s(json); StreamType s(json);
Reader reader; Reader reader;
ScanCopyUnescapedStringHandler h; ScanCopyUnescapedStringHandler h;
reader.Parse(s, h); reader.Parse<parseFlags>(s, h);
EXPECT_TRUE(memcmp(h.buffer, json + 1, step) == 0); EXPECT_TRUE(memcmp(h.buffer, json + 1, step) == 0);
EXPECT_EQ('\\', h.buffer[step]); // escaped EXPECT_EQ('\\', h.buffer[step]); // escaped
EXPECT_EQ('\0', h.buffer[step + 1]); EXPECT_EQ('\0', h.buffer[step + 1]);
...@@ -104,8 +104,8 @@ void TestScanCopyUnescapedString() { ...@@ -104,8 +104,8 @@ void TestScanCopyUnescapedString() {
} }
TEST(SIMD, SIMD_SUFFIX(ScanCopyUnescapedString)) { TEST(SIMD, SIMD_SUFFIX(ScanCopyUnescapedString)) {
TestScanCopyUnescapedString<StringStream>(); TestScanCopyUnescapedString<kParseDefaultFlags, StringStream>();
TestScanCopyUnescapedString<InsituStringStream>(); TestScanCopyUnescapedString<kParseInsituFlag, InsituStringStream>();
} }
#ifdef __GNUC__ #ifdef __GNUC__
......
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