Skip to content

Commit

Permalink
add test for sso optimized string
Browse files Browse the repository at this point in the history
  • Loading branch information
tretiy authored and miloyip committed Sep 24, 2024
1 parent 805d7ed commit 815e6e7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/unittest/valuetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,14 @@ TEST(Value, MergeDuplicateKey) {
EXPECT_EQ(d2, d);
}

TEST(Value, SSOMemoryOverlapTest) {
Document d;
d.Parse("{\"project\":\"rapidjson\",\"stars\":\"ssovalue\"}");
Value &s = d["stars"];
s.SetString(GenericStringRef<char>(&(s.GetString()[1]), 5), d.GetAllocator());
EXPECT_TRUE(strcmp(s.GetString(),"soval") == 0);
}

#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif

0 comments on commit 815e6e7

Please sign in to comment.