Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKosta <konstantin.baumann@autodesk.com>2014-09-01 14:46:04 +0400
committerKosta <konstantin.baumann@autodesk.com>2014-09-01 14:46:04 +0400
commit609997565ca355cb0abad60542293e47beebac03 (patch)
treefecfa2c21cc2d1e3f342dcd1c6163f4efe9f06cb
parent88debcf02edadd8ad7c0a2a8b566bb40414541d0 (diff)
unit test simplification for `short string optimization`
-rw-r--r--test/unittest/valuetest.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/test/unittest/valuetest.cpp b/test/unittest/valuetest.cpp
index 8e3fe8f2..0df5f34a 100644
--- a/test/unittest/valuetest.cpp
+++ b/test/unittest/valuetest.cpp
@@ -1089,14 +1089,11 @@ static void TestShortStringOptimization(const char* str) {
const int len = (int)strlen(str);
rapidjson::Document doc;
- rapidjson::Document::AllocatorType& allocator = doc.GetAllocator();
- rapidjson::Value objVal(rapidjson::kObjectType);
-
- objVal.AddMember(str, len, allocator);
- EXPECT_TRUE(objVal.HasMember(str));
+ rapidjson::Value val;
+ val.SetString(str, len, doc.GetAllocator());
- const rapidjson::Value& member = objVal[str];
- EXPECT_EQ(member.GetStringLength(), strlen(str));
+ EXPECT_EQ(val.GetStringLength(), len);
+ EXPECT_STREQ(val.GetString(), str);
}
TEST(Value, AllocateShortString) {