14 #include <Poco/SharedPtr.h>
15 #include <gtest/gtest.h>
24 std::vector<std::pair<unsigned int, std::string> >
messages =
50 TEST(LoggerStreamTest, defaultModeWriteToBuffer)
56 ASSERT_EQ(logger.
logMsg(),
"test 1");
59 ASSERT_EQ(logger.
logMsg(),
"TEST 2\n");
62 TEST(LoggerStreamTest, modeWriteToStream)
65 std::stringstream str;
70 ASSERT_EQ(str.str(),
"TEST CONSOLE\n");
73 logger.
log() <<
"THIS NEVER BEEN TO STREAM" <<
std::endl;
78 ASSERT_EQ(logger.
logMsg(),
"THIS NEVER BEEN TO STREAM\ntest 3\n");
81 TEST(LoggerStreamTest, useEndlMamipulator)
88 ASSERT_EQ(logger.
logMsg(),
"test 4\n");
93 std::string msg = logger.
logMsg();
94 ASSERT_TRUE(msg.find(
"test 5")!=std::string::npos && msg.find(
"test 6")!=std::string::npos);
98 ASSERT_EQ(logger.
logMsg(),
"test 7");
105 ASSERT_EQ(msg(0),
"TEST START. ");
106 ASSERT_EQ(msg(1, 42),
"TEST DATA: 42 ");
107 ASSERT_EQ(msg(2,
"USER MESSAGE"),
"TEST MSG: USER MESSAGE ");
108 ASSERT_EQ(msg(3),
"TEST STOP. ");
119 ASSERT_EQ(msg(0),
"TEST START;*");
120 ASSERT_EQ(msg(1, 42),
"TEST DATA-*42*");
121 ASSERT_EQ(msg(2,
"USER MESSAGE"),
"TEST MSG-*USER MESSAGE*");
122 ASSERT_EQ(msg(3),
"TEST STOP;*");
125 int main (
int argc,
char** argv)
127 testing::InitGoogleTest(&argc, argv);
128 return RUN_ALL_TESTS();