commit
d0146c4476
@ -368,6 +368,14 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericValue& Swap(GenericValue& other) {
|
||||||
|
char temp[sizeof(GenericValue)];
|
||||||
|
memcpy(&temp[0], this, sizeof(GenericValue));
|
||||||
|
memcpy(this, &other, sizeof(GenericValue));
|
||||||
|
memcpy(&other, temp, sizeof(GenericValue));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//!@name Type
|
//!@name Type
|
||||||
|
@ -56,6 +56,16 @@ TEST(Value, CopyFrom)
|
|||||||
EXPECT_NE(v1[1].GetString(), v2[1].GetString()); // string got copied
|
EXPECT_NE(v1[1].GetString(), v2[1].GetString()); // string got copied
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Value, Swap) {
|
||||||
|
Value v1(1234);
|
||||||
|
Value v2(kObjectType);
|
||||||
|
|
||||||
|
EXPECT_EQ(&v1, &v1.Swap(v2));
|
||||||
|
EXPECT_TRUE(v1.IsObject());
|
||||||
|
EXPECT_TRUE(v2.IsInt());
|
||||||
|
EXPECT_EQ(1234, v2.GetInt());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Value, Null) {
|
TEST(Value, Null) {
|
||||||
// Default constructor
|
// Default constructor
|
||||||
Value x;
|
Value x;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user