Changeset 10624 for code/trunk/test/util/output
- Timestamp:
- Oct 4, 2015, 9:12:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
-
code/trunk/test/util/output/ConsoleWriterTest.cc
r9547 r10624 7 7 namespace orxonox 8 8 { 9 TEST(ConsoleWriterTest, Disable)9 namespace 10 10 { 11 // reset output manager 12 OutputManager::Testing::getInstancePointer() = new OutputManager(); 11 // Fixture 12 class ConsoleWriterTest : public ::testing::Test 13 { 14 public: 15 virtual void SetUp() 16 { 17 // reset output manager 18 OutputManager::Testing::getInstancePointer() = new OutputManager(); 19 } 13 20 21 virtual void TearDown() 22 { 23 } 24 }; 25 } 26 27 TEST_F(ConsoleWriterTest, Disable) 28 { 14 29 std::ostream stream(NULL); 15 30 EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size()); … … 20 35 } 21 36 22 TEST (ConsoleWriterTest, Enable)37 TEST_F(ConsoleWriterTest, Enable) 23 38 { 24 // reset output manager25 OutputManager::Testing::getInstancePointer() = new OutputManager();26 27 39 std::ostream stream(NULL); 28 40 ConsoleWriter writer(stream); … … 33 45 } 34 46 35 TEST (ConsoleWriterTest, WritesNoOutputToOutputStream)47 TEST_F(ConsoleWriterTest, WritesNoOutputToOutputStream) 36 48 { 37 49 std::stringbuf buffer; … … 44 56 } 45 57 46 TEST (ConsoleWriterTest, WritesOutputToOutputStream)58 TEST_F(ConsoleWriterTest, WritesOutputToOutputStream) 47 59 { 48 60 std::stringbuf buffer; … … 63 75 } 64 76 65 TEST (ConsoleWriterTest, DefaultConsoleWriterUsesCout)77 TEST_F(ConsoleWriterTest, DefaultConsoleWriterUsesCout) 66 78 { 67 79 OutputManager::getInstanceAndCreateListeners(); -
code/trunk/test/util/output/LogWriterTest.cc
r9549 r10624 3 3 #include "util/output/LogWriter.h" 4 4 #include "util/Convert.h" 5 #include "util/output/OutputManager.h" 6 #include "util/SharedPtr.h" 5 7 6 8 namespace orxonox … … 14 16 { this->LogWriter::printLine(line, level); } 15 17 }; 18 19 // Fixture 20 class LogWriterTest : public ::testing::Test 21 { 22 public: 23 virtual void SetUp() 24 { 25 // reset output manager 26 OutputManager::Testing::getInstancePointer() = new OutputManager(); 27 } 28 29 virtual void TearDown() 30 { 31 } 32 }; 16 33 } 17 34 18 35 // test constructor opens file 19 TEST (LogWriterTest, ConstructorOpensFile)36 TEST_F(LogWriterTest, ConstructorOpensFile) 20 37 { 21 38 LogWriter logWriter; … … 64 81 } 65 82 66 TEST (LogWriterTest, SetLogDirectoryOpensNewFile)83 TEST_F(LogWriterTest, SetLogDirectoryOpensNewFile) 67 84 { 68 85 std::string path = "./orxonox.log"; … … 83 100 84 101 // prints output to logfile 85 TEST (LogWriterTest, PrintsOutputToLogfile)102 TEST_F(LogWriterTest, PrintsOutputToLogfile) 86 103 { 87 104 std::string path; … … 103 120 104 121 // prints time to logfile 105 TEST (LogWriterTest, PrintsTimestampToLogfile)122 TEST_F(LogWriterTest, PrintsTimestampToLogfile) 106 123 { 107 124 std::string path; … … 152 169 } 153 170 154 TEST (LogWriterTest, ArchivesOldLogFile)171 TEST_F(LogWriterTest, ArchivesOldLogFile) 155 172 { 156 173 deleteAllLogFiles(); … … 196 213 } 197 214 198 TEST (LogWriterTest, ArchivesNineLogFiles)215 TEST_F(LogWriterTest, ArchivesNineLogFiles) 199 216 { 200 217 deleteAllLogFiles(); -
code/trunk/test/util/output/MemoryWriterTest.cc
r9545 r10624 4 4 #include "util/output/MemoryWriter.h" 5 5 #include "util/output/OutputManager.h" 6 #include "util/SharedPtr.h" 6 7 7 8 namespace orxonox … … 14 15 MOCK_METHOD3(output, void(OutputLevel, const OutputContextContainer&, const std::vector<std::string>&)); 15 16 }; 17 18 // Fixture 19 class MemoryWriterTest : public ::testing::Test 20 { 21 public: 22 virtual void SetUp() 23 { 24 // reset output manager 25 OutputManager::Testing::getInstancePointer() = new OutputManager(); 26 } 27 28 virtual void TearDown() 29 { 30 } 31 }; 16 32 } 17 33 18 TEST (MemoryWriterTest, Disable)34 TEST_F(MemoryWriterTest, Disable) 19 35 { 20 36 EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size()); … … 25 41 } 26 42 27 TEST (MemoryWriterTest, ResendOutput)43 TEST_F(MemoryWriterTest, ResendOutput) 28 44 { 29 45 MemoryWriter writer; -
code/trunk/test/util/output/OutputManagerTest.cc
r9547 r10624 98 98 99 99 EXPECT_FALSE(manager.getListeners().empty()); 100 101 manager.unregisterListener(&listener); 100 102 } 101 103 … … 123 125 124 126 EXPECT_FALSE(listener.getListeners().empty()); 127 128 manager.unregisterListener(&listener); 125 129 } 126 130 … … 156 160 EXPECT_EQ(level::verbose_more, manager.getCombinedAdditionalContextsLevelMask()); 157 161 EXPECT_EQ(context::unittest2().mask, manager.getCombinedAdditionalContextsMask()); 162 163 manager.unregisterListener(&listener); 158 164 } 159 165 … … 193 199 194 200 EXPECT_EQ(level::internal_warning, manager.getCombinedLevelMask()); 201 202 manager.unregisterListener(&listener); 195 203 } 196 204 … … 208 216 209 217 EXPECT_EQ(level::internal_warning, manager.getCombinedAdditionalContextsLevelMask()); 218 219 manager.unregisterListener(&listener); 210 220 } 211 221 … … 223 233 224 234 EXPECT_EQ(context::unittest2().mask, manager.getCombinedAdditionalContextsMask()); 235 236 manager.unregisterListener(&listener); 225 237 } 226 238 … … 254 266 EXPECT_EQ(level::verbose | level::verbose_more | level::verbose_ultra, manager.getCombinedAdditionalContextsLevelMask()); 255 267 EXPECT_EQ(context::unittest1().mask | context::unittest2().mask | context::unittest3().mask, manager.getCombinedAdditionalContextsMask()); 268 269 manager.unregisterListener(&listener1); 270 manager.unregisterListener(&listener2); 271 manager.unregisterListener(&listener3); 256 272 } 257 273 … … 287 303 EXPECT_TRUE(manager.acceptsOutput(level::verbose_more, context::unittest2())); 288 304 EXPECT_FALSE(manager.acceptsOutput(level::verbose_ultra, context::unittest2())); 305 306 manager.unregisterListener(&listener); 289 307 } 290 308 … … 302 320 303 321 manager.pushMessage(level::user_status, context::unittest1(), "some output"); 322 323 manager.unregisterListener(&listener); 304 324 } 305 325 … … 319 339 320 340 manager.pushMessage(level::user_status, context::unittest1(), "some output\nand some more output\n!!!"); 341 342 manager.unregisterListener(&listener); 321 343 } 322 344
Note: See TracChangeset
for help on using the changeset viewer.