Commit 8ba1f84f authored by bluehero's avatar bluehero

modify unittest

parent 9eb7bf89
...@@ -290,14 +290,6 @@ TEST(Document, ParseStream_AutoUTFInputStream) { ...@@ -290,14 +290,6 @@ TEST(Document, ParseStream_AutoUTFInputStream) {
EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize())); EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize()));
} }
TEST(Document, Assignment) {
Value x(1234);
Document d;
d = x;
EXPECT_TRUE(x.IsNull()); // move semantic
EXPECT_EQ(1234, d.GetInt());
}
TEST(Document, Swap) { TEST(Document, Swap) {
Document d1; Document d1;
Document::AllocatorType& a = d1.GetAllocator(); Document::AllocatorType& a = d1.GetAllocator();
...@@ -667,13 +659,20 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) { ...@@ -667,13 +659,20 @@ TYPED_TEST(DocumentMove, MoveAssignmentStack) {
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
// Issue 22: Memory corruption via operator= // Issue 22: Memory corruption via operator= from Document
// Fixed by making unimplemented assignment operator private. // Fixed by making unimplemented assignment operator private.
//TEST(Document, Assignment) { // Prohibit assignment from Document, But allow assignment from Value
TEST(Document, Assignment) {
// Document d1; // Document d1;
// Document d2; // Document d2;
// d1 = d2; // d1 = d2;
//}
Value x(1234);
Document d;
d = x;
EXPECT_TRUE(x.IsNull()); // move semantic
EXPECT_EQ(1234, d.GetInt());
}
#ifdef __clang__ #ifdef __clang__
RAPIDJSON_DIAG_POP RAPIDJSON_DIAG_POP
......
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