mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-03-06 04:55:50 +01:00
Extend the test on issue #1336 to cover all basic types
This commit is contained in:
parent
3fc9299b84
commit
c9eabf9e13
@ -340,14 +340,32 @@ TEST(PrettyWriter, MoveCtor) {
|
||||
#endif
|
||||
|
||||
TEST(PrettyWriter, Issue_1336) {
|
||||
char buf[100] = "Hello";
|
||||
#define T(meth, val, expected) \
|
||||
{ \
|
||||
StringBuffer buffer; \
|
||||
PrettyWriter<StringBuffer> writer(buffer); \
|
||||
writer.meth(val); \
|
||||
\
|
||||
EXPECT_STREQ(expected, buffer.GetString()); \
|
||||
EXPECT_TRUE(writer.IsComplete()); \
|
||||
}
|
||||
|
||||
T(Bool, false, "false");
|
||||
T(Bool, true, "true");
|
||||
T(Int, 0, "0");
|
||||
T(Uint, 0, "0");
|
||||
T(Int64, 0, "0");
|
||||
T(Uint64, 0, "0");
|
||||
T(Double, 0, "0.0");
|
||||
T(String, "Hello", "\"Hello\"");
|
||||
#undef T
|
||||
|
||||
StringBuffer buffer;
|
||||
PrettyWriter<StringBuffer> writer(buffer);
|
||||
writer.String(buf);
|
||||
writer.Null();
|
||||
|
||||
EXPECT_STREQ("\"Hello\"", buffer.GetString());
|
||||
EXPECT_TRUE(writer.IsComplete()); \
|
||||
EXPECT_STREQ("null", buffer.GetString());
|
||||
EXPECT_TRUE(writer.IsComplete());
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
|
Loading…
x
Reference in New Issue
Block a user