Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10624 for code/trunk/test/util


Ignore:
Timestamp:
Oct 4, 2015, 9:12:21 PM (9 years ago)
Author:
landauf
Message:

merged branch core7 back to trunk

Location:
code/trunk
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/test/util/CMakeLists.txt

    r10188 r10624  
    1313    MultiTypeTest.cc
    1414    OutputTest.cc
    15     ScopeTest.cc
    1615    SharedPtrTest.cc
    1716    SingletonTest.cc
  • code/trunk/test/util/output/ConsoleWriterTest.cc

    r9547 r10624  
    77namespace orxonox
    88{
    9     TEST(ConsoleWriterTest, Disable)
     9    namespace
    1010    {
    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                }
    1320
     21                virtual void TearDown()
     22                {
     23                }
     24        };
     25    }
     26
     27    TEST_F(ConsoleWriterTest, Disable)
     28    {
    1429        std::ostream stream(NULL);
    1530        EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size());
     
    2035    }
    2136
    22     TEST(ConsoleWriterTest, Enable)
     37    TEST_F(ConsoleWriterTest, Enable)
    2338    {
    24         // reset output manager
    25         OutputManager::Testing::getInstancePointer() = new OutputManager();
    26 
    2739        std::ostream stream(NULL);
    2840        ConsoleWriter writer(stream);
     
    3345    }
    3446
    35     TEST(ConsoleWriterTest, WritesNoOutputToOutputStream)
     47    TEST_F(ConsoleWriterTest, WritesNoOutputToOutputStream)
    3648    {
    3749        std::stringbuf buffer;
     
    4456    }
    4557
    46     TEST(ConsoleWriterTest, WritesOutputToOutputStream)
     58    TEST_F(ConsoleWriterTest, WritesOutputToOutputStream)
    4759    {
    4860        std::stringbuf buffer;
     
    6375    }
    6476
    65     TEST(ConsoleWriterTest, DefaultConsoleWriterUsesCout)
     77    TEST_F(ConsoleWriterTest, DefaultConsoleWriterUsesCout)
    6678    {
    6779        OutputManager::getInstanceAndCreateListeners();
  • code/trunk/test/util/output/LogWriterTest.cc

    r9549 r10624  
    33#include "util/output/LogWriter.h"
    44#include "util/Convert.h"
     5#include "util/output/OutputManager.h"
     6#include "util/SharedPtr.h"
    57
    68namespace orxonox
     
    1416                    { this->LogWriter::printLine(line, level); }
    1517        };
     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        };
    1633    }
    1734
    1835    // test constructor opens file
    19     TEST(LogWriterTest, ConstructorOpensFile)
     36    TEST_F(LogWriterTest, ConstructorOpensFile)
    2037    {
    2138        LogWriter logWriter;
     
    6481    }
    6582
    66     TEST(LogWriterTest, SetLogDirectoryOpensNewFile)
     83    TEST_F(LogWriterTest, SetLogDirectoryOpensNewFile)
    6784    {
    6885        std::string path = "./orxonox.log";
     
    83100
    84101    // prints output to logfile
    85     TEST(LogWriterTest, PrintsOutputToLogfile)
     102    TEST_F(LogWriterTest, PrintsOutputToLogfile)
    86103    {
    87104        std::string path;
     
    103120
    104121    // prints time to logfile
    105     TEST(LogWriterTest, PrintsTimestampToLogfile)
     122    TEST_F(LogWriterTest, PrintsTimestampToLogfile)
    106123    {
    107124        std::string path;
     
    152169    }
    153170
    154     TEST(LogWriterTest, ArchivesOldLogFile)
     171    TEST_F(LogWriterTest, ArchivesOldLogFile)
    155172    {
    156173        deleteAllLogFiles();
     
    196213    }
    197214
    198     TEST(LogWriterTest, ArchivesNineLogFiles)
     215    TEST_F(LogWriterTest, ArchivesNineLogFiles)
    199216    {
    200217        deleteAllLogFiles();
  • code/trunk/test/util/output/MemoryWriterTest.cc

    r9545 r10624  
    44#include "util/output/MemoryWriter.h"
    55#include "util/output/OutputManager.h"
     6#include "util/SharedPtr.h"
    67
    78namespace orxonox
     
    1415                MOCK_METHOD3(output, void(OutputLevel, const OutputContextContainer&, const std::vector<std::string>&));
    1516        };
     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        };
    1632    }
    1733
    18     TEST(MemoryWriterTest, Disable)
     34    TEST_F(MemoryWriterTest, Disable)
    1935    {
    2036        EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size());
     
    2541    }
    2642
    27     TEST(MemoryWriterTest, ResendOutput)
     43    TEST_F(MemoryWriterTest, ResendOutput)
    2844    {
    2945        MemoryWriter writer;
  • code/trunk/test/util/output/OutputManagerTest.cc

    r9547 r10624  
    9898
    9999        EXPECT_FALSE(manager.getListeners().empty());
     100
     101        manager.unregisterListener(&listener);
    100102    }
    101103
     
    123125
    124126        EXPECT_FALSE(listener.getListeners().empty());
     127
     128        manager.unregisterListener(&listener);
    125129    }
    126130
     
    156160        EXPECT_EQ(level::verbose_more, manager.getCombinedAdditionalContextsLevelMask());
    157161        EXPECT_EQ(context::unittest2().mask, manager.getCombinedAdditionalContextsMask());
     162
     163        manager.unregisterListener(&listener);
    158164    }
    159165
     
    193199
    194200        EXPECT_EQ(level::internal_warning, manager.getCombinedLevelMask());
     201
     202        manager.unregisterListener(&listener);
    195203    }
    196204
     
    208216
    209217        EXPECT_EQ(level::internal_warning, manager.getCombinedAdditionalContextsLevelMask());
     218
     219        manager.unregisterListener(&listener);
    210220    }
    211221
     
    223233
    224234        EXPECT_EQ(context::unittest2().mask, manager.getCombinedAdditionalContextsMask());
     235
     236        manager.unregisterListener(&listener);
    225237    }
    226238
     
    254266        EXPECT_EQ(level::verbose | level::verbose_more | level::verbose_ultra, manager.getCombinedAdditionalContextsLevelMask());
    255267        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);
    256272    }
    257273
     
    287303        EXPECT_TRUE(manager.acceptsOutput(level::verbose_more, context::unittest2()));
    288304        EXPECT_FALSE(manager.acceptsOutput(level::verbose_ultra, context::unittest2()));
     305
     306        manager.unregisterListener(&listener);
    289307    }
    290308
     
    302320
    303321        manager.pushMessage(level::user_status, context::unittest1(), "some output");
     322
     323        manager.unregisterListener(&listener);
    304324    }
    305325
     
    319339
    320340        manager.pushMessage(level::user_status, context::unittest1(), "some output\nand some more output\n!!!");
     341
     342        manager.unregisterListener(&listener);
    321343    }
    322344
Note: See TracChangeset for help on using the changeset viewer.