Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11071 for code/trunk/test/util


Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (9 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/test/util/MathTest.cc

    r11052 r11071  
    245245
    246246        // all numbers must satisfy 0 <= <number> < 1
    247         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
     247        for (float number : numbers)
    248248        {
    249             EXPECT_LE(min, *it);
    250             EXPECT_GT(max, *it);
     249            EXPECT_LE(min, number);
     250            EXPECT_GT(max, number);
    251251        }
    252252    }
     
    268268
    269269        // all numbers must satisfy 0 <= <number> < <max>
    270         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
     270        for (float number : numbers)
    271271        {
    272             EXPECT_LE(min, *it);
    273             EXPECT_GT(max, *it);
     272            EXPECT_LE(min, number);
     273            EXPECT_GT(max, number);
    274274        }
    275275    }
     
    291291
    292292        // all numbers must satisfy <min> <= <number> < <max>
    293         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
     293        for (float number : numbers)
    294294        {
    295             EXPECT_LE(min, *it);
    296             EXPECT_GT(max, *it);
     295            EXPECT_LE(min, number);
     296            EXPECT_GT(max, number);
    297297        }
    298298    }
     
    315315
    316316        // all numbers must be either 1 oder -1
    317         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
    318             EXPECT_TRUE(*it == 1 || *it == -1);
     317        for (float number : numbers)
     318            EXPECT_TRUE(number == 1 || number == -1);
    319319    }
    320320
  • code/trunk/test/util/MultiTypeTest.cc

    r10197 r11071  
    697697        EXPECT_TRUE(mt.null());
    698698    }
     699
     700    ///////////////////////////////
     701    // Strongly typed enum class //
     702    ///////////////////////////////
     703    enum class EnumWithChar : unsigned char
     704    {
     705        ValueA = 'A',
     706        ValueB = 'B',
     707        ValueC = 'C',
     708    };
     709    enum class EnumWithInt
     710    {
     711        Value1 = 50,
     712        Value2 = 0,
     713        Value3,
     714    };
     715
     716    TEST(MultiType, Enum_Constructor)
     717    {
     718        // Constructor:
     719        {
     720            MultiType mt = EnumWithChar::ValueA;
     721
     722            EXPECT_TRUE(mt.isType<EnumWithChar>());
     723            EXPECT_EQ(EnumWithChar::ValueA, mt.get<EnumWithChar>());
     724        }
     725        {
     726            MultiType mt = MultiType(EnumWithInt::Value1);
     727
     728            EXPECT_TRUE(mt.isType<EnumWithInt>());
     729            EXPECT_EQ(EnumWithInt::Value1, mt.get<EnumWithInt>());
     730        }
     731    }
     732
     733    TEST(MultiType, Enum_Assignment)
     734    {
     735        // operator=:
     736        MultiType mt;
     737        mt = EnumWithChar::ValueB;
     738
     739        EXPECT_TRUE(mt.isType<EnumWithChar>());
     740        EXPECT_EQ(EnumWithChar::ValueB, mt.get<EnumWithChar>());
     741    }
     742
     743    TEST(MultiType, Enum_Set)
     744    {
     745        // set(value):
     746        {
     747            MultiType mt;
     748            mt.set(EnumWithInt::Value2); // assign enum to an empty MultiType
     749
     750            EXPECT_TRUE(mt.isType<EnumWithInt>());
     751            EXPECT_EQ(EnumWithInt::Value2, mt.get<EnumWithInt>());
     752        }
     753        {
     754            MultiType mt = "string";
     755            mt.set(EnumWithChar::ValueC); // assign enum to a MultiType with type std::string
     756
     757            EXPECT_TRUE(mt.isType<std::string>());
     758            EXPECT_EQ("C", mt.get<std::string>());
     759        }
     760        {
     761            MultiType mt = EnumWithChar::ValueA;
     762            mt.set(EnumWithChar::ValueB); // assign enum to a MultiType with type std::string
     763
     764            EXPECT_TRUE(mt.isType<EnumWithChar>());
     765            EXPECT_EQ(EnumWithChar::ValueB, mt.get<EnumWithChar>());
     766        }
     767        {
     768            MultiType mt = EnumWithInt::Value3;
     769            mt.set("50"); // assign enum to a MultiType with type std::string
     770
     771            EXPECT_TRUE(mt.isType<EnumWithInt>());
     772            EXPECT_EQ(EnumWithInt::Value1, mt.get<EnumWithInt>());
     773        }
     774    }
     775
     776    TEST(MultiType, Enum_Force)
     777    {
     778        // force(value):
     779        {
     780            MultiType mt = "string";
     781            EXPECT_TRUE(mt.isType<std::string>());
     782            EXPECT_EQ("string", mt.get<std::string>());
     783
     784            mt.force<EnumWithChar>("C");
     785
     786            EXPECT_TRUE(mt.isType<EnumWithChar>());
     787            EXPECT_EQ(EnumWithChar::ValueC, mt.get<EnumWithChar>());
     788        }
     789        {
     790            MultiType mt = EnumWithChar::ValueA;
     791            EXPECT_TRUE(mt.isType<EnumWithChar>());
     792            EXPECT_EQ(EnumWithChar::ValueA, mt.get<EnumWithChar>());
     793
     794            mt.force<std::string>(EnumWithChar::ValueB);
     795
     796            EXPECT_TRUE(mt.isType<std::string>());
     797            EXPECT_EQ("B", mt.get<std::string>());
     798        }
     799    }
     800
     801    TEST(MultiType, Enum_Convert)
     802    {
     803        // convert():
     804        {
     805            MultiType mt = "C";
     806            mt.convert<EnumWithChar>();
     807
     808            EXPECT_TRUE(mt.isType<EnumWithChar>());
     809            EXPECT_EQ(EnumWithChar::ValueC, mt.get<EnumWithChar>());
     810        }
     811        {
     812            MultiType mt = EnumWithChar::ValueA;
     813            mt.convert<std::string>();
     814
     815            EXPECT_TRUE(mt.isType<std::string>());
     816            EXPECT_EQ("A", mt.get<std::string>());
     817        }
     818    }
     819
     820    TEST(MultiType, Enum_Reset)
     821    {
     822        // reset():
     823        {
     824            MultiType mt = EnumWithChar::ValueA;
     825            mt.reset<EnumWithChar>();
     826
     827            EXPECT_TRUE(mt.isType<EnumWithChar>());
     828            EXPECT_TRUE(mt.isType<unsigned char>());
     829            EXPECT_EQ('\0', mt.get<unsigned char>());
     830        }
     831        {
     832            MultiType mt = "string";
     833            mt.reset<EnumWithInt>();
     834
     835            EXPECT_TRUE(mt.isType<EnumWithInt>());
     836            EXPECT_TRUE(mt.isType<int>());
     837            EXPECT_EQ(0, mt.get<int>());
     838        }
     839    }
     840
     841    TEST(MultiType, Enum_IsType)
     842    {
     843        // isType():
     844        {
     845            MultiType mt = EnumWithChar::ValueB;
     846            EXPECT_TRUE(mt.isType<EnumWithChar>());
     847            EXPECT_TRUE(mt.isType<unsigned char>());
     848            EXPECT_FALSE(mt.isType<char>());
     849            EXPECT_FALSE(mt.isType<int>());
     850            EXPECT_FALSE(mt.isType<bool>());
     851            EXPECT_FALSE(mt.isType<std::string>());
     852        }
     853        {
     854            MultiType mt = EnumWithInt::Value3;
     855            EXPECT_TRUE(mt.isType<EnumWithInt>());
     856            EXPECT_TRUE(mt.isType<int>());
     857            EXPECT_FALSE(mt.isType<unsigned char>());
     858            EXPECT_FALSE(mt.isType<char>());
     859            EXPECT_FALSE(mt.isType<bool>());
     860            EXPECT_FALSE(mt.isType<std::string>());
     861        }
     862    }
     863
     864    TEST(MultiType, Enum_ConversionOperator)
     865    {
     866        // conversion operator:
     867        {
     868            MultiType mt = EnumWithChar::ValueA;
     869            EnumWithChar value = mt;
     870            EXPECT_EQ(EnumWithChar::ValueA, value);
     871        }
     872        {
     873            MultiType mt = 'B';
     874            EnumWithChar value = mt;
     875            EXPECT_EQ(EnumWithChar::ValueB, value);
     876        }
     877        {
     878            MultiType mt = EnumWithInt::Value1;
     879            std::string value = mt;
     880            EXPECT_EQ("50", value);
     881        }
     882    }
     883
     884    TEST(MultiType, Enum_GetValue)
     885    {
     886        // getValue():
     887        {
     888            MultiType mt = EnumWithChar::ValueA;
     889            EnumWithChar value;
     890            mt.getValue(&value);
     891            EXPECT_EQ(EnumWithChar::ValueA, value);
     892        }
     893        {
     894            MultiType mt = 'B';
     895            EnumWithChar value;
     896            mt.getValue(&value);
     897            EXPECT_EQ(EnumWithChar::ValueB, value);
     898        }
     899        {
     900            MultiType mt = EnumWithInt::Value1;
     901            std::string value;
     902            mt.getValue(&value);
     903            EXPECT_EQ("50", value);
     904        }
     905    }
     906
     907    TEST(MultiType, Enum_Get)
     908    {
     909        // get():
     910        {
     911            MultiType mt = EnumWithChar::ValueB;
     912            EXPECT_EQ(EnumWithChar::ValueB, mt.get<EnumWithChar>());
     913
     914            EXPECT_EQ('B', mt.get<unsigned char>());
     915            EXPECT_EQ("B", mt.get<std::string>());
     916            EXPECT_EQ(66, mt.get<int>());
     917            EXPECT_TRUE(mt.get<bool>());
     918        }
     919        {
     920            MultiType mt = EnumWithInt::Value1;
     921            EXPECT_EQ(EnumWithInt::Value1, mt.get<EnumWithInt>());
     922
     923            EXPECT_EQ('2', mt.get<unsigned char>());
     924            EXPECT_EQ("50", mt.get<std::string>());
     925            EXPECT_EQ(50, mt.get<int>());
     926            EXPECT_TRUE(mt.get<bool>());
     927        }
     928        {
     929            MultiType mt = EnumWithInt::Value2;
     930            EXPECT_EQ(EnumWithInt::Value2, mt.get<EnumWithInt>());
     931
     932            EXPECT_EQ('\0', mt.get<unsigned char>());
     933            EXPECT_EQ("0", mt.get<std::string>());
     934            EXPECT_EQ(0, mt.get<int>());
     935            EXPECT_FALSE(mt.get<bool>());
     936        }
     937    }
    699938}
  • code/trunk/test/util/SharedPtrTest.cc

    r9114 r11071  
     1#include <memory>
     2#include <utility>
    13#include <gtest/gtest.h>
    24#include <gmock/gmock.h>
    3 #include "util/SharedPtr.h"
    45
    56namespace orxonox
     
    2728        };
    2829
    29         class TestClassMock : public TestClass
     30        class TestChildClassMock : public TestChildClass
    3031        {
    3132            public:
    32                 TestClassMock() {}
    33                 ~TestClassMock() { objectDestroyed(); }
     33                TestChildClassMock() {}
     34                ~TestChildClassMock() { objectDestroyed(); }
    3435
    3536                MOCK_METHOD0(objectDestroyed, void());
     
    3940    TEST(SharedPtr, ConstructorDefault)
    4041    {
    41         SharedPtr<TestClass> test;
    42         EXPECT_EQ(0, test.get());
     42        std::shared_ptr<TestClass> test;
     43        EXPECT_EQ(nullptr, test.get());
    4344    }
    4445
     
    4748        TestClass* pointer = new TestClass();
    4849
    49         SharedPtr<TestClass> test = pointer;
    50         EXPECT_EQ(pointer, test.get());
     50        std::shared_ptr<TestClass> test(pointer);
     51        EXPECT_EQ(pointer, test.get());
     52        EXPECT_EQ(pointer, &(*test));
    5153    }
    5254
     
    5557        TestChildClass* pointer = new TestChildClass();
    5658
    57         SharedPtr<TestClass> test = pointer;
     59        std::shared_ptr<TestClass> test(pointer);
    5860        EXPECT_EQ(pointer, test.get());
    5961    }
     
    6365        TestClass* pointer = new TestClass();
    6466
    65         SharedPtr<TestClass> other = pointer;
    66         EXPECT_EQ(pointer, other.get());
    67 
    68         SharedPtr<TestClass> test = other;
     67        std::shared_ptr<TestClass> other(pointer);
     68        EXPECT_EQ(pointer, other.get());
     69
     70        std::shared_ptr<TestClass> test = other;
    6971        EXPECT_EQ(pointer, test.get());
    7072    }
     
    7476        TestChildClass* pointer = new TestChildClass();
    7577
    76         SharedPtr<TestChildClass> other = pointer;
    77         EXPECT_EQ(pointer, other.get());
    78 
    79         SharedPtr<TestClass> test = other;
     78        std::shared_ptr<TestChildClass> other(pointer);
     79        EXPECT_EQ(pointer, other.get());
     80
     81        std::shared_ptr<TestClass> test = other;
    8082        EXPECT_EQ(pointer, test.get());
    8183    }
     
    8587        TestClass* pointer = new TestClass();
    8688
    87         SharedPtr<TestClass> other = pointer;
    88         EXPECT_EQ(pointer, other.get());
    89 
    90         SharedPtr<TestClass> test;
    91         EXPECT_EQ(0, test.get());
     89        std::shared_ptr<TestClass> other(pointer);
     90        EXPECT_EQ(pointer, other.get());
     91
     92        std::shared_ptr<TestClass> test;
     93        EXPECT_EQ(nullptr, test.get());
    9294
    9395        test = other;
     
    99101        TestChildClass* pointer = new TestChildClass();
    100102
    101         SharedPtr<TestChildClass> other = pointer;
    102         EXPECT_EQ(pointer, other.get());
    103 
    104         SharedPtr<TestClass> test;
    105         EXPECT_EQ(0, test.get());
     103        std::shared_ptr<TestChildClass> other(pointer);
     104        EXPECT_EQ(pointer, other.get());
     105
     106        std::shared_ptr<TestClass> test;
     107        EXPECT_EQ(nullptr, test.get());
    106108
    107109        test = other;
     
    113115        TestChildClass* pointer = new TestChildClass();
    114116
    115         SharedPtr<TestChildClass> other = pointer;
    116         EXPECT_EQ(pointer, other.get());
    117 
    118         SharedPtr<TestClass> test = other.cast<TestClass>();
     117        std::shared_ptr<TestChildClass> other(pointer);
     118        EXPECT_EQ(pointer, other.get());
     119
     120        std::shared_ptr<TestClass> test = std::static_pointer_cast<TestClass>(other);
    119121        EXPECT_EQ(pointer, test.get());
    120122    }
     
    124126        TestClass* pointer = new TestClass();
    125127
    126         SharedPtr<TestClass> test = pointer;
     128        std::shared_ptr<TestClass> test(pointer);
    127129        EXPECT_EQ(pointer, test.get());
    128130
     
    135137    TEST(SharedPtr, Boolean)
    136138    {
    137         SharedPtr<TestClass> test;
    138         EXPECT_EQ(0, test.get());
     139        std::shared_ptr<TestClass> test;
     140        EXPECT_EQ(nullptr, test.get());
    139141        EXPECT_FALSE(test);
    140142
    141143        TestClass* pointer = new TestClass();
    142144
    143         test = pointer;
    144         EXPECT_EQ(pointer, test.get());
    145         EXPECT_TRUE(test);
     145        test.reset(pointer);
     146        EXPECT_EQ(pointer, test.get());
     147        EXPECT_TRUE(static_cast<bool>(test));
    146148    }
    147149
     
    151153        TestClass* pointer2 = new TestClass();
    152154
    153         SharedPtr<TestClass> test1 = pointer1;
    154         SharedPtr<TestClass> test2 = pointer2;
     155        std::shared_ptr<TestClass> test1(pointer1);
     156        std::shared_ptr<TestClass> test2(pointer2);
    155157
    156158        EXPECT_EQ(pointer1, test1.get());
     
    165167    TEST(SharedPtr, ObjectDestroyedOnePointer)
    166168    {
    167         TestClassMock* pointer = new TestClassMock();
    168         SharedPtr<TestClass> test = pointer;
     169        TestChildClassMock* pointer = new TestChildClassMock();
     170        std::shared_ptr<TestClass> test(pointer);
    169171
    170172        EXPECT_CALL(*pointer, objectDestroyed()).Times(1);
     
    173175    TEST(SharedPtr, ObjectDestroyedManyPointers)
    174176    {
    175         TestClassMock* pointer = new TestClassMock();
    176 
    177         SharedPtr<TestClass> test = pointer;
    178         std::vector<SharedPtr<TestClass> > tests;
     177        TestChildClassMock* pointer = new TestChildClassMock();
     178
     179        std::shared_ptr<TestClass> test(pointer);
     180        std::vector<std::shared_ptr<TestClass>> tests;
    179181        for (size_t i = 0; i < 100; ++i)
    180             tests.push_back(SharedPtr<TestClass>(test));
     182            tests.push_back(std::shared_ptr<TestClass>(test));
     183
     184        EXPECT_CALL(*pointer, objectDestroyed()).Times(1);
     185    }
     186
     187    TEST(SharedPtr, TestConstructors)
     188    {
     189        {
     190        TestChildClassMock* pointer = new TestChildClassMock();
     191
     192        // default
     193        std::shared_ptr<TestChildClass> sharedPtr1;
     194        EXPECT_EQ(nullptr, sharedPtr1.get());
     195
     196        // pointer
     197        std::shared_ptr<TestChildClass> sharedPtr2(pointer);
     198        EXPECT_EQ(pointer, sharedPtr2.get());
     199
     200        // copy
     201        std::shared_ptr<TestChildClass> sharedPtr3(sharedPtr2);
     202        EXPECT_EQ(pointer, sharedPtr3.get());
     203
     204        // move
     205        std::shared_ptr<TestChildClass> sharedPtr4(std::move(sharedPtr3));
     206        EXPECT_EQ(pointer, sharedPtr4.get());
     207
     208        // other
     209        std::shared_ptr<TestClass> sharedPtr5(sharedPtr4);
     210        EXPECT_EQ(pointer, sharedPtr5.get());
     211
     212        EXPECT_CALL(*pointer, objectDestroyed()).Times(1);
     213        }
     214    }
     215
     216    TEST(SharedPtr, TestConstructors2)
     217    {
     218        {
     219        TestChildClassMock* pointer = new TestChildClassMock();
     220
     221        // default
     222        std::shared_ptr<TestChildClass> sharedPtr1;
     223        EXPECT_EQ(nullptr, sharedPtr1.get());
     224
     225        // pointer
     226        std::shared_ptr<TestChildClass> sharedPtr2(pointer);
     227        EXPECT_EQ(pointer, sharedPtr2.get());
     228
     229        // copy
     230        std::shared_ptr<TestChildClass> sharedPtr3 = sharedPtr2;
     231        EXPECT_EQ(pointer, sharedPtr3.get());
     232
     233        // move
     234        std::shared_ptr<TestChildClass> sharedPtr4 = std::move(sharedPtr3);
     235        EXPECT_EQ(pointer, sharedPtr4.get());
     236
     237        // other
     238        std::shared_ptr<TestClass> sharedPtr5 = sharedPtr4;
     239        EXPECT_EQ(pointer, sharedPtr5.get());
     240
     241        EXPECT_CALL(*pointer, objectDestroyed()).Times(1);
     242        }
     243    }
     244
     245    TEST(SharedPtr, TestAssignments)
     246    {
     247        TestChildClassMock* pointer = new TestChildClassMock();
     248
     249        std::shared_ptr<TestChildClass> sharedPtr1(pointer);
     250        EXPECT_EQ(pointer, sharedPtr1.get());
     251
     252        // copy
     253        std::shared_ptr<TestChildClass> sharedPtr2;
     254        sharedPtr2 = sharedPtr1;
     255        EXPECT_EQ(pointer, sharedPtr2.get());
     256
     257        // move
     258        std::shared_ptr<TestChildClass> sharedPtr3;
     259        sharedPtr3 = std::move(sharedPtr2);
     260        EXPECT_EQ(pointer, sharedPtr3.get());
     261
     262        // other
     263        std::shared_ptr<TestClass> sharedPtr4;
     264        sharedPtr4 = sharedPtr3;
     265        EXPECT_EQ(pointer, sharedPtr4.get());
    181266
    182267        EXPECT_CALL(*pointer, objectDestroyed()).Times(1);
  • code/trunk/test/util/SingletonTest.cc

    r9114 r11071  
    2323        };
    2424
    25         TestSingleton* TestSingleton::singletonPtr_s = NULL;
     25        TestSingleton* TestSingleton::singletonPtr_s = nullptr;
    2626        const size_t TestSingleton::MAGIC_VALUE = 0xCAFEBABE;
    2727    }
  • code/trunk/test/util/SmallObjectAllocatorTest.cc

    r9114 r11071  
    4747        // create an integer
    4848        size_t* pointer = this->create(5);
    49         ASSERT_NE((void*)0, pointer);
     49        ASSERT_NE((void*)nullptr, pointer);
    5050        EXPECT_EQ(5u, *pointer);
    5151    }
     
    5555        // create an integer
    5656        size_t* pointer = this->create(5);
    57         ASSERT_NE((void*)0, pointer);
     57        ASSERT_NE((void*)nullptr, pointer);
    5858        EXPECT_EQ(5u, *pointer);
    5959
     
    228228        // create an object
    229229        SmallObject* pointer = this->create(5);
    230         ASSERT_NE((void*)0, pointer);
     230        ASSERT_NE((void*)nullptr, pointer);
    231231        EXPECT_EQ(5u, pointer->getValue());
    232232        EXPECT_EQ(5u, SmallObject::total_s);
     
    239239        // create an object
    240240        SmallObject* pointer = this->create(5);
    241         ASSERT_NE((void*)0, pointer);
     241        ASSERT_NE((void*)nullptr, pointer);
    242242        EXPECT_EQ(5u, pointer->getValue());
    243243        EXPECT_EQ(5u, SmallObject::total_s);
  • code/trunk/test/util/output/BaseWriterTest.cc

    r9545 r11071  
    3030                MOCK_METHOD2(printLine, void(const std::string&, OutputLevel));
    3131
    32                 virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
     32                virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines) override
    3333                    { this->BaseWriter::output(level, context, lines); }
    3434        };
  • code/trunk/test/util/output/ConsoleWriterTest.cc

    r10712 r11071  
    33#include "util/output/ConsoleWriter.h"
    44#include "util/output/OutputManager.h"
    5 #include "util/SharedPtr.h"
    65
    76namespace orxonox
     
    1312        {
    1413            public:
    15                 virtual void SetUp()
     14                virtual void SetUp() override
    1615                {
    1716                    // reset output manager
    18                     OutputManager::Testing::getInstancePointer() = new OutputManager();
     17                    OutputManager::Testing::getInstancePointer().reset(new OutputManager());
    1918                }
    2019
    21                 virtual void TearDown()
     20                virtual void TearDown() override
    2221                {
    2322                }
     
    2726    TEST_F(ConsoleWriterTest, Disable)
    2827    {
    29         std::ostream stream(NULL);
     28        std::ostream stream(nullptr);
    3029        EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size());
    3130        ConsoleWriter writer(stream);
     
    3736    TEST_F(ConsoleWriterTest, Enable)
    3837    {
    39         std::ostream stream(NULL);
     38        std::ostream stream(nullptr);
    4039        ConsoleWriter writer(stream);
    4140        writer.disable();
  • code/trunk/test/util/output/LogWriterTest.cc

    r10624 r11071  
    44#include "util/Convert.h"
    55#include "util/output/OutputManager.h"
    6 #include "util/SharedPtr.h"
    76
    87namespace orxonox
     
    1312        {
    1413            public:
    15                 virtual void printLine(const std::string& line, OutputLevel level)
     14                virtual void printLine(const std::string& line, OutputLevel level) override
    1615                    { this->LogWriter::printLine(line, level); }
    1716        };
     
    2120        {
    2221            public:
    23                 virtual void SetUp()
     22                virtual void SetUp() override
    2423                {
    2524                    // reset output manager
    26                     OutputManager::Testing::getInstancePointer() = new OutputManager();
     25                    OutputManager::Testing::getInstancePointer().reset(new OutputManager());
    2726                }
    2827
    29                 virtual void TearDown()
     28                virtual void TearDown() override
    3029                {
    3130                }
     
    138137        std::string line = getLineWhichContains(path, "myothertestoutput");
    139138        EXPECT_FALSE(line.empty());
     139        ASSERT_TRUE(line.length() > 12);
     140
    140141        EXPECT_TRUE(isdigit(line[0]));
    141142        EXPECT_TRUE(isdigit(line[1]));
     
    146147        EXPECT_TRUE(isdigit(line[6]));
    147148        EXPECT_TRUE(isdigit(line[7]));
    148         EXPECT_EQ(' ', line[8]);
     149        EXPECT_EQ(':', line[8]);
     150        EXPECT_TRUE(isdigit(line[9]));
     151        EXPECT_TRUE(isdigit(line[10]));
     152        EXPECT_TRUE(isdigit(line[11]));
     153        EXPECT_EQ(' ', line[12]);
    149154    }
    150155
  • code/trunk/test/util/output/MemoryWriterTest.cc

    r10624 r11071  
    44#include "util/output/MemoryWriter.h"
    55#include "util/output/OutputManager.h"
    6 #include "util/SharedPtr.h"
    76
    87namespace orxonox
     
    2019        {
    2120            public:
    22                 virtual void SetUp()
     21                virtual void SetUp() override
    2322                {
    2423                    // reset output manager
    25                     OutputManager::Testing::getInstancePointer() = new OutputManager();
     24                    OutputManager::Testing::getInstancePointer().reset(new OutputManager());
    2625                }
    2726
    28                 virtual void TearDown()
     27                virtual void TearDown() override
    2928                {
    3029                }
  • code/trunk/test/util/output/OutputListenerTest.cc

    r9545 r11071  
    33#include "util/output/OutputListener.h"
    44#include "util/output/OutputManager.h"
    5 #include "util/SharedPtr.h"
    65
    76namespace orxonox
     
    342341            {
    343342                this->manager_ = new MockOutputManager();
    344                 OutputManager::Testing::getInstancePointer() = this->manager_;
     343                OutputManager::Testing::getInstancePointer().reset(this->manager_);
    345344            }
    346345
    347346            virtual void TearDown()
    348347            {
    349                 OutputManager::Testing::getInstancePointer() = new OutputManager();
     348                OutputManager::Testing::getInstancePointer().reset(new OutputManager());
    350349            }
    351350
  • code/trunk/test/util/output/OutputManagerTest.cc

    r10624 r11071  
    5454    TEST(OutputManagerTest, GetInstanceDoesNotCreateDefaultListeners)
    5555    {
    56         EXPECT_TRUE(NULL == OutputManager::getInstance().getMemoryWriter());
    57         EXPECT_TRUE(NULL == OutputManager::getInstance().getConsoleWriter());
    58         EXPECT_TRUE(NULL == OutputManager::getInstance().getLogWriter());
     56        EXPECT_TRUE(nullptr == OutputManager::getInstance().getMemoryWriter());
     57        EXPECT_TRUE(nullptr == OutputManager::getInstance().getConsoleWriter());
     58        EXPECT_TRUE(nullptr == OutputManager::getInstance().getLogWriter());
    5959    }
    6060
     
    6262    TEST(OutputManagerTest, GetInstanceAndCreateListenersCreatesDefaultListeners)
    6363    {
    64         EXPECT_TRUE(NULL != OutputManager::getInstanceAndCreateListeners().getMemoryWriter());
    65         EXPECT_TRUE(NULL != OutputManager::getInstanceAndCreateListeners().getConsoleWriter());
    66         EXPECT_TRUE(NULL != OutputManager::getInstanceAndCreateListeners().getLogWriter());
     64        EXPECT_TRUE(nullptr != OutputManager::getInstanceAndCreateListeners().getMemoryWriter());
     65        EXPECT_TRUE(nullptr != OutputManager::getInstanceAndCreateListeners().getConsoleWriter());
     66        EXPECT_TRUE(nullptr != OutputManager::getInstanceAndCreateListeners().getLogWriter());
    6767    }
    6868
  • code/trunk/test/util/output/OutputStreamTest.cc

    r9547 r11071  
    88#include "util/output/OutputManager.h"
    99#include "util/output/MemoryWriter.h"
    10 #include "util/SharedPtr.h"
    1110
    1211namespace orxonox
     
    8887            {
    8988                this->manager_ = new MockOutputManager();
    90                 OutputManager::Testing::getInstancePointer() = this->manager_;
     89                OutputManager::Testing::getInstancePointer().reset(this->manager_);
    9190            }
    9291
    9392            virtual void TearDown()
    9493            {
    95                 OutputManager::Testing::getInstancePointer() = new OutputManager();
     94                OutputManager::Testing::getInstancePointer().reset(new OutputManager());
    9695            }
    9796
Note: See TracChangeset for help on using the changeset viewer.