39 using ::testing::Message;
44 TEST(MessageTest, DefaultConstructor) {
50 TEST(MessageTest, CopyConstructor) {
51 const Message msg1(
"Hello");
52 const Message msg2(msg1);
57 TEST(MessageTest, ConstructsFromCString) {
63 TEST(MessageTest, StreamsFloat) {
64 const std::string s = (Message() << 1.23456F <<
" " << 2.34567F).GetString();
71 TEST(MessageTest, StreamsDouble) {
72 const std::string s = (Message() << 1260570880.4555497 <<
" "
73 << 1260572265.1954534).GetString();
80 TEST(MessageTest, StreamsPointer) {
83 EXPECT_NE(
"(null)", (Message() << p).GetString());
87 TEST(MessageTest, StreamsNullPointer) {
89 EXPECT_EQ(
"(null)", (Message() << p).GetString());
93 TEST(MessageTest, StreamsCString) {
94 EXPECT_EQ(
"Foo", (Message() <<
"Foo").GetString());
98 TEST(MessageTest, StreamsNullCString) {
100 EXPECT_EQ(
"(null)", (Message() << p).GetString());
104 TEST(MessageTest, StreamsString) {
105 const ::std::string str(
"Hello");
106 EXPECT_EQ(
"Hello", (Message() << str).GetString());
110 TEST(MessageTest, StreamsStringWithEmbeddedNUL) {
111 const char char_array_with_nul[] =
112 "Here's a NUL\0 and some more string";
113 const ::std::string string_with_nul(char_array_with_nul,
114 sizeof(char_array_with_nul) - 1);
115 EXPECT_EQ(
"Here's a NUL\\0 and some more string",
116 (Message() << string_with_nul).GetString());
120 TEST(MessageTest, StreamsNULChar) {
121 EXPECT_EQ(
"\\0", (Message() <<
'\0').GetString());
125 TEST(MessageTest, StreamsInt) {
126 EXPECT_EQ(
"123", (Message() << 123).GetString());
131 TEST(MessageTest, StreamsBasicIoManip) {
132 EXPECT_EQ(
"Line 1.\nA NUL char \\0 in line 2.",
133 (Message() <<
"Line 1." << std::endl
134 <<
"A NUL char " << std::ends << std::flush
135 <<
" in line 2.").GetString());
139 TEST(MessageTest, GetString) {
146 TEST(MessageTest, StreamsToOStream) {
147 Message msg(
"Hello");
148 ::std::stringstream ss;
154 TEST(MessageTest, DoesNotTakeUpMuchStackSpace) {
#define EXPECT_PRED_FORMAT2(pred_format, v1, v2)
#define EXPECT_LE(val1, val2)
#define EXPECT_NE(val1, val2)
#define TEST(test_suite_name, test_name)
GTEST_API_ AssertionResult IsSubstring(const char *needle_expr, const char *haystack_expr, const char *needle, const char *haystack)
#define EXPECT_EQ(val1, val2)
GTEST_API_ std::string StringStreamToString(::std::stringstream *stream)