Changeset 9537 for code/branches/testing/test/util/output
- Timestamp:
- Mar 4, 2013, 11:23:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/testing/test/util/output/ConsoleWriterTest.cc
r9535 r9537 8 8 TEST(ConsoleWriterTest, Disable) 9 9 { 10 std::ostream stream(NULL); 10 11 EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size()); 11 ConsoleWriter writer ;12 ConsoleWriter writer(stream); 12 13 EXPECT_EQ(1U, OutputManager::getInstance().getListeners().size()); 13 14 writer.disable(); … … 17 18 TEST(ConsoleWriterTest, Enable) 18 19 { 19 ConsoleWriter writer; 20 std::ostream stream(NULL); 21 ConsoleWriter writer(stream); 20 22 writer.disable(); 21 23 EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size()); … … 23 25 EXPECT_EQ(1U, OutputManager::getInstance().getListeners().size()); 24 26 } 27 28 TEST(ConsoleWriterTest, WritesNoOutputToOutputStream) 29 { 30 std::stringbuf buffer; 31 std::ostream stream(&buffer); 32 ConsoleWriter writer(stream); 33 writer.setLevelMax(level::verbose); 34 35 EXPECT_EQ(0, buffer.in_avail()); 36 EXPECT_EQ("", buffer.str()); 37 } 38 39 TEST(ConsoleWriterTest, WritesOutputToOutputStream) 40 { 41 std::stringbuf buffer; 42 std::ostream stream(&buffer); 43 ConsoleWriter writer(stream); 44 writer.setLevelMax(level::verbose); 45 46 std::vector<std::string> lines; 47 lines.push_back("test"); 48 49 EXPECT_TRUE(writer.acceptsOutput(level::debug_output, context::undefined())); 50 51 writer.unfilteredOutput(level::debug_output, context::undefined(), lines); 52 53 EXPECT_LT(0, buffer.in_avail()); 54 EXPECT_NE("", buffer.str()); 55 EXPECT_NE(std::string::npos, buffer.str().find("test")); 56 } 57 58 TEST(ConsoleWriterTest, DefaultConsoleWriterUsesCout) 59 { 60 EXPECT_EQ(std::cout, OutputManager::getInstance().getConsoleWriter().getOutputStream()); 61 } 25 62 }
Note: See TracChangeset
for help on using the changeset viewer.