unit test simplification for short string optimization

This commit is contained in:
Kosta 2014-09-01 12:46:04 +02:00
parent 88debcf02e
commit 609997565c

View File

@ -1089,14 +1089,11 @@ static void TestShortStringOptimization(const char* str) {
const int len = (int)strlen(str); const int len = (int)strlen(str);
rapidjson::Document doc; rapidjson::Document doc;
rapidjson::Document::AllocatorType& allocator = doc.GetAllocator(); rapidjson::Value val;
rapidjson::Value objVal(rapidjson::kObjectType); val.SetString(str, len, doc.GetAllocator());
objVal.AddMember(str, len, allocator); EXPECT_EQ(val.GetStringLength(), len);
EXPECT_TRUE(objVal.HasMember(str)); EXPECT_STREQ(val.GetString(), str);
const rapidjson::Value& member = objVal[str];
EXPECT_EQ(member.GetStringLength(), strlen(str));
} }
TEST(Value, AllocateShortString) { TEST(Value, AllocateShortString) {