Changeset 11071 for code/trunk/test/util
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/test/util/MathTest.cc
r11052 r11071 245 245 246 246 // 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) 248 248 { 249 EXPECT_LE(min, *it);250 EXPECT_GT(max, *it);249 EXPECT_LE(min, number); 250 EXPECT_GT(max, number); 251 251 } 252 252 } … … 268 268 269 269 // 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) 271 271 { 272 EXPECT_LE(min, *it);273 EXPECT_GT(max, *it);272 EXPECT_LE(min, number); 273 EXPECT_GT(max, number); 274 274 } 275 275 } … … 291 291 292 292 // 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) 294 294 { 295 EXPECT_LE(min, *it);296 EXPECT_GT(max, *it);295 EXPECT_LE(min, number); 296 EXPECT_GT(max, number); 297 297 } 298 298 } … … 315 315 316 316 // 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); 319 319 } 320 320 -
code/trunk/test/util/MultiTypeTest.cc
r10197 r11071 697 697 EXPECT_TRUE(mt.null()); 698 698 } 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 } 699 938 } -
code/trunk/test/util/SharedPtrTest.cc
r9114 r11071 1 #include <memory> 2 #include <utility> 1 3 #include <gtest/gtest.h> 2 4 #include <gmock/gmock.h> 3 #include "util/SharedPtr.h"4 5 5 6 namespace orxonox … … 27 28 }; 28 29 29 class TestC lassMock : public TestClass30 class TestChildClassMock : public TestChildClass 30 31 { 31 32 public: 32 TestC lassMock() {}33 ~TestC lassMock() { objectDestroyed(); }33 TestChildClassMock() {} 34 ~TestChildClassMock() { objectDestroyed(); } 34 35 35 36 MOCK_METHOD0(objectDestroyed, void()); … … 39 40 TEST(SharedPtr, ConstructorDefault) 40 41 { 41 SharedPtr<TestClass> test;42 EXPECT_EQ( 0, test.get());42 std::shared_ptr<TestClass> test; 43 EXPECT_EQ(nullptr, test.get()); 43 44 } 44 45 … … 47 48 TestClass* pointer = new TestClass(); 48 49 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)); 51 53 } 52 54 … … 55 57 TestChildClass* pointer = new TestChildClass(); 56 58 57 SharedPtr<TestClass> test = pointer;59 std::shared_ptr<TestClass> test(pointer); 58 60 EXPECT_EQ(pointer, test.get()); 59 61 } … … 63 65 TestClass* pointer = new TestClass(); 64 66 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; 69 71 EXPECT_EQ(pointer, test.get()); 70 72 } … … 74 76 TestChildClass* pointer = new TestChildClass(); 75 77 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; 80 82 EXPECT_EQ(pointer, test.get()); 81 83 } … … 85 87 TestClass* pointer = new TestClass(); 86 88 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()); 92 94 93 95 test = other; … … 99 101 TestChildClass* pointer = new TestChildClass(); 100 102 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()); 106 108 107 109 test = other; … … 113 115 TestChildClass* pointer = new TestChildClass(); 114 116 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); 119 121 EXPECT_EQ(pointer, test.get()); 120 122 } … … 124 126 TestClass* pointer = new TestClass(); 125 127 126 SharedPtr<TestClass> test = pointer;128 std::shared_ptr<TestClass> test(pointer); 127 129 EXPECT_EQ(pointer, test.get()); 128 130 … … 135 137 TEST(SharedPtr, Boolean) 136 138 { 137 SharedPtr<TestClass> test;138 EXPECT_EQ( 0, test.get());139 std::shared_ptr<TestClass> test; 140 EXPECT_EQ(nullptr, test.get()); 139 141 EXPECT_FALSE(test); 140 142 141 143 TestClass* pointer = new TestClass(); 142 144 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)); 146 148 } 147 149 … … 151 153 TestClass* pointer2 = new TestClass(); 152 154 153 SharedPtr<TestClass> test1 = pointer1;154 SharedPtr<TestClass> test2 = pointer2;155 std::shared_ptr<TestClass> test1(pointer1); 156 std::shared_ptr<TestClass> test2(pointer2); 155 157 156 158 EXPECT_EQ(pointer1, test1.get()); … … 165 167 TEST(SharedPtr, ObjectDestroyedOnePointer) 166 168 { 167 TestC lassMock* pointer = new TestClassMock();168 SharedPtr<TestClass> test = pointer;169 TestChildClassMock* pointer = new TestChildClassMock(); 170 std::shared_ptr<TestClass> test(pointer); 169 171 170 172 EXPECT_CALL(*pointer, objectDestroyed()).Times(1); … … 173 175 TEST(SharedPtr, ObjectDestroyedManyPointers) 174 176 { 175 TestC lassMock* 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; 179 181 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()); 181 266 182 267 EXPECT_CALL(*pointer, objectDestroyed()).Times(1); -
code/trunk/test/util/SingletonTest.cc
r9114 r11071 23 23 }; 24 24 25 TestSingleton* TestSingleton::singletonPtr_s = NULL;25 TestSingleton* TestSingleton::singletonPtr_s = nullptr; 26 26 const size_t TestSingleton::MAGIC_VALUE = 0xCAFEBABE; 27 27 } -
code/trunk/test/util/SmallObjectAllocatorTest.cc
r9114 r11071 47 47 // create an integer 48 48 size_t* pointer = this->create(5); 49 ASSERT_NE((void*) 0, pointer);49 ASSERT_NE((void*)nullptr, pointer); 50 50 EXPECT_EQ(5u, *pointer); 51 51 } … … 55 55 // create an integer 56 56 size_t* pointer = this->create(5); 57 ASSERT_NE((void*) 0, pointer);57 ASSERT_NE((void*)nullptr, pointer); 58 58 EXPECT_EQ(5u, *pointer); 59 59 … … 228 228 // create an object 229 229 SmallObject* pointer = this->create(5); 230 ASSERT_NE((void*) 0, pointer);230 ASSERT_NE((void*)nullptr, pointer); 231 231 EXPECT_EQ(5u, pointer->getValue()); 232 232 EXPECT_EQ(5u, SmallObject::total_s); … … 239 239 // create an object 240 240 SmallObject* pointer = this->create(5); 241 ASSERT_NE((void*) 0, pointer);241 ASSERT_NE((void*)nullptr, pointer); 242 242 EXPECT_EQ(5u, pointer->getValue()); 243 243 EXPECT_EQ(5u, SmallObject::total_s); -
code/trunk/test/util/output/BaseWriterTest.cc
r9545 r11071 30 30 MOCK_METHOD2(printLine, void(const std::string&, OutputLevel)); 31 31 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 33 33 { this->BaseWriter::output(level, context, lines); } 34 34 }; -
code/trunk/test/util/output/ConsoleWriterTest.cc
r10712 r11071 3 3 #include "util/output/ConsoleWriter.h" 4 4 #include "util/output/OutputManager.h" 5 #include "util/SharedPtr.h"6 5 7 6 namespace orxonox … … 13 12 { 14 13 public: 15 virtual void SetUp() 14 virtual void SetUp() override 16 15 { 17 16 // reset output manager 18 OutputManager::Testing::getInstancePointer() = new OutputManager();17 OutputManager::Testing::getInstancePointer().reset(new OutputManager()); 19 18 } 20 19 21 virtual void TearDown() 20 virtual void TearDown() override 22 21 { 23 22 } … … 27 26 TEST_F(ConsoleWriterTest, Disable) 28 27 { 29 std::ostream stream( NULL);28 std::ostream stream(nullptr); 30 29 EXPECT_EQ(0U, OutputManager::getInstance().getListeners().size()); 31 30 ConsoleWriter writer(stream); … … 37 36 TEST_F(ConsoleWriterTest, Enable) 38 37 { 39 std::ostream stream( NULL);38 std::ostream stream(nullptr); 40 39 ConsoleWriter writer(stream); 41 40 writer.disable(); -
code/trunk/test/util/output/LogWriterTest.cc
r10624 r11071 4 4 #include "util/Convert.h" 5 5 #include "util/output/OutputManager.h" 6 #include "util/SharedPtr.h"7 6 8 7 namespace orxonox … … 13 12 { 14 13 public: 15 virtual void printLine(const std::string& line, OutputLevel level) 14 virtual void printLine(const std::string& line, OutputLevel level) override 16 15 { this->LogWriter::printLine(line, level); } 17 16 }; … … 21 20 { 22 21 public: 23 virtual void SetUp() 22 virtual void SetUp() override 24 23 { 25 24 // reset output manager 26 OutputManager::Testing::getInstancePointer() = new OutputManager();25 OutputManager::Testing::getInstancePointer().reset(new OutputManager()); 27 26 } 28 27 29 virtual void TearDown() 28 virtual void TearDown() override 30 29 { 31 30 } … … 138 137 std::string line = getLineWhichContains(path, "myothertestoutput"); 139 138 EXPECT_FALSE(line.empty()); 139 ASSERT_TRUE(line.length() > 12); 140 140 141 EXPECT_TRUE(isdigit(line[0])); 141 142 EXPECT_TRUE(isdigit(line[1])); … … 146 147 EXPECT_TRUE(isdigit(line[6])); 147 148 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]); 149 154 } 150 155 -
code/trunk/test/util/output/MemoryWriterTest.cc
r10624 r11071 4 4 #include "util/output/MemoryWriter.h" 5 5 #include "util/output/OutputManager.h" 6 #include "util/SharedPtr.h"7 6 8 7 namespace orxonox … … 20 19 { 21 20 public: 22 virtual void SetUp() 21 virtual void SetUp() override 23 22 { 24 23 // reset output manager 25 OutputManager::Testing::getInstancePointer() = new OutputManager();24 OutputManager::Testing::getInstancePointer().reset(new OutputManager()); 26 25 } 27 26 28 virtual void TearDown() 27 virtual void TearDown() override 29 28 { 30 29 } -
code/trunk/test/util/output/OutputListenerTest.cc
r9545 r11071 3 3 #include "util/output/OutputListener.h" 4 4 #include "util/output/OutputManager.h" 5 #include "util/SharedPtr.h"6 5 7 6 namespace orxonox … … 342 341 { 343 342 this->manager_ = new MockOutputManager(); 344 OutputManager::Testing::getInstancePointer() = this->manager_;343 OutputManager::Testing::getInstancePointer().reset(this->manager_); 345 344 } 346 345 347 346 virtual void TearDown() 348 347 { 349 OutputManager::Testing::getInstancePointer() = new OutputManager();348 OutputManager::Testing::getInstancePointer().reset(new OutputManager()); 350 349 } 351 350 -
code/trunk/test/util/output/OutputManagerTest.cc
r10624 r11071 54 54 TEST(OutputManagerTest, GetInstanceDoesNotCreateDefaultListeners) 55 55 { 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()); 59 59 } 60 60 … … 62 62 TEST(OutputManagerTest, GetInstanceAndCreateListenersCreatesDefaultListeners) 63 63 { 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()); 67 67 } 68 68 -
code/trunk/test/util/output/OutputStreamTest.cc
r9547 r11071 8 8 #include "util/output/OutputManager.h" 9 9 #include "util/output/MemoryWriter.h" 10 #include "util/SharedPtr.h"11 10 12 11 namespace orxonox … … 88 87 { 89 88 this->manager_ = new MockOutputManager(); 90 OutputManager::Testing::getInstancePointer() = this->manager_;89 OutputManager::Testing::getInstancePointer().reset(this->manager_); 91 90 } 92 91 93 92 virtual void TearDown() 94 93 { 95 OutputManager::Testing::getInstancePointer() = new OutputManager();94 OutputManager::Testing::getInstancePointer().reset(new OutputManager()); 96 95 } 97 96
Note: See TracChangeset
for help on using the changeset viewer.