From 9a89eed11a1c559a73570c1ec423eca858a4415b Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Wed, 9 Jul 2014 09:24:34 +0200 Subject: [PATCH] adopt AddMember tests from #47 (726f986,b7bf73c) --- test/unittest/valuetest.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/unittest/valuetest.cpp b/test/unittest/valuetest.cpp index 39500d02..fcf36a32 100644 --- a/test/unittest/valuetest.cpp +++ b/test/unittest/valuetest.cpp @@ -591,6 +591,27 @@ TEST(Value, Object) { Value value("Banana", 6); x.AddMember("B", "Banana", allocator); + // AddMember(StringRefType, T, Allocator) + { + Value o(kObjectType); + o.AddMember("true", true, allocator); + o.AddMember("false", false, allocator); + o.AddMember("int", -1, allocator); + o.AddMember("uint", 1u, allocator); + o.AddMember("int64", INT64_C(-4294967296), allocator); + o.AddMember("uint64", UINT64_C(4294967296), allocator); + o.AddMember("double", 3.14, allocator); + o.AddMember("string", "Jelly", allocator); + + EXPECT_TRUE(o["true"].GetBool()); + EXPECT_FALSE(o["false"].GetBool()); + EXPECT_EQ(-1, o["int"].GetInt()); + EXPECT_EQ(1u, o["uint"].GetUint()); + EXPECT_EQ(INT64_C(-4294967296), o["int64"].GetInt64()); + EXPECT_EQ(UINT64_C(4294967296), o["uint64"].GetUint64()); + EXPECT_STREQ("Jelly",o["string"].GetString()); + } + // Tests a member with null character Value name; const Value C0D("C\0D", 3);