From 8f9ff88c29bfc294a7905751020a1b42bcaadb54 Mon Sep 17 00:00:00 2001 From: Milo Yip Date: Fri, 15 Apr 2016 17:03:23 +0800 Subject: [PATCH] Add Writer. ScanWriteUnescapedString to try to improve coverage --- test/unittest/writertest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unittest/writertest.cpp b/test/unittest/writertest.cpp index 7db1c62c..cd0a32e1 100644 --- a/test/unittest/writertest.cpp +++ b/test/unittest/writertest.cpp @@ -95,6 +95,18 @@ TEST(Writer, String) { #endif } +TEST(Writer, ScanWriteUnescapedString) { + const char json[] = "[\" \\\"\"]"; + char buffer2[sizeof(json) + 32]; + + // Use different offset to test different alignments + for (int i = 0; i < 32; i++) { + char* p = buffer2 + i; + memcpy(p, json, sizeof(json)); + TEST_ROUNDTRIP(p); + } +} + TEST(Writer, Double) { TEST_ROUNDTRIP("[1.2345,1.2345678,0.123456789012,1234567.8]"); TEST_ROUNDTRIP("0.0");