In Value.CopyFrom unit test, run both allocators.

@pah
This commit is contained in:
Milo Yip 2014-07-03 22:57:09 +08:00
parent d0146c4476
commit 80a5b9093c

View File

@ -25,12 +25,8 @@ TEST(Value, assignment_operator) {
EXPECT_EQ(1234, y.GetInt()); EXPECT_EQ(1234, y.GetInt());
} }
TEST(Value, CopyFrom) template <typename Value>
{ void TestCopyFrom() {
// use CrtAllocator to explicitly malloc/free any memory
// comment this line to use the default Allocator instead
typedef GenericValue<UTF8<>,CrtAllocator> Value;
Value::AllocatorType a; Value::AllocatorType a;
Value v1(1234); Value v1(1234);
Value v2(v1, a); // deep copy constructor Value v2(v1, a); // deep copy constructor
@ -56,6 +52,11 @@ 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, CopyFrom) {
TestCopyFrom<Value>();
TestCopyFrom<GenericValue<UTF8<>, CrtAllocator> >();
}
TEST(Value, Swap) { TEST(Value, Swap) {
Value v1(1234); Value v1(1234);
Value v2(kObjectType); Value v2(kObjectType);