[9639] | 1 | #include <gtest/gtest.h> |
---|
| 2 | #include "core/CoreIncludes.h" |
---|
| 3 | #include "core/class/Identifiable.h" |
---|
| 4 | #include "core/class/OrxonoxClass.h" |
---|
| 5 | #include "core/class/OrxonoxInterface.h" |
---|
[10624] | 6 | #include "core/module/ModuleInstance.h" |
---|
[9639] | 7 | |
---|
| 8 | namespace orxonox |
---|
| 9 | { |
---|
| 10 | // +------ Class0 |
---|
| 11 | // BaseClass <-----+---------------------+--- Class1 |
---|
| 12 | // +---------------------+-+- Class2a |
---|
| 13 | // +---------------------+-+- Class2b |
---|
| 14 | // +-+-+-- Class3 | | |
---|
| 15 | // | | | | |
---|
[10624] | 16 | // BaseInterface1 <--+---- Interface1 <--´ | |
---|
[9639] | 17 | // | | |
---|
[10624] | 18 | // BaseInterface2 <----+-- Interface2 <----´ |
---|
[9639] | 19 | |
---|
| 20 | namespace |
---|
| 21 | { |
---|
[10624] | 22 | class BaseInterface1 : virtual public OrxonoxInterface |
---|
[9646] | 23 | { |
---|
| 24 | public: |
---|
| 25 | BaseInterface1() |
---|
| 26 | { |
---|
[9659] | 27 | RegisterObject(BaseInterface1); |
---|
[9646] | 28 | } |
---|
[9639] | 29 | |
---|
[9646] | 30 | virtual void test1() = 0; |
---|
| 31 | }; |
---|
| 32 | |
---|
[10624] | 33 | class BaseInterface2 : virtual public OrxonoxInterface |
---|
[9646] | 34 | { |
---|
| 35 | public: |
---|
| 36 | BaseInterface2() |
---|
| 37 | { |
---|
[9659] | 38 | RegisterObject(BaseInterface2); |
---|
[9646] | 39 | } |
---|
[9639] | 40 | |
---|
[9646] | 41 | virtual void test2() = 0; |
---|
| 42 | }; |
---|
| 43 | |
---|
[9639] | 44 | class Interface1 : public BaseInterface1 |
---|
[9646] | 45 | { |
---|
| 46 | public: |
---|
| 47 | Interface1() |
---|
| 48 | { |
---|
| 49 | RegisterObject(Interface1); |
---|
| 50 | } |
---|
| 51 | }; |
---|
[9639] | 52 | |
---|
| 53 | class Interface2 : public BaseInterface2 |
---|
[9646] | 54 | { |
---|
| 55 | public: |
---|
| 56 | Interface2() |
---|
| 57 | { |
---|
| 58 | RegisterObject(Interface2); |
---|
| 59 | } |
---|
| 60 | }; |
---|
[9639] | 61 | |
---|
| 62 | class BaseClass : public OrxonoxClass |
---|
[9646] | 63 | { |
---|
| 64 | public: |
---|
| 65 | BaseClass() |
---|
| 66 | { |
---|
[9659] | 67 | RegisterObject(BaseClass); |
---|
[9646] | 68 | } |
---|
| 69 | }; |
---|
[9639] | 70 | |
---|
| 71 | class Class0 : public BaseClass |
---|
[9646] | 72 | { |
---|
| 73 | public: |
---|
| 74 | Class0() |
---|
| 75 | { |
---|
| 76 | RegisterObject(Class0); |
---|
| 77 | } |
---|
| 78 | }; |
---|
[9639] | 79 | |
---|
| 80 | class Class1 : public BaseClass, public Interface1 |
---|
[9646] | 81 | { |
---|
| 82 | public: |
---|
| 83 | Class1() |
---|
| 84 | { |
---|
| 85 | RegisterObject(Class1); |
---|
| 86 | } |
---|
[9639] | 87 | |
---|
[11071] | 88 | virtual void test1() override {} |
---|
[9646] | 89 | }; |
---|
| 90 | |
---|
[9639] | 91 | class Class2a : public BaseClass, public Interface1, Interface2 |
---|
[9646] | 92 | { |
---|
| 93 | public: |
---|
| 94 | Class2a() |
---|
| 95 | { |
---|
| 96 | RegisterObject(Class2a); |
---|
| 97 | } |
---|
[9639] | 98 | |
---|
[11071] | 99 | virtual void test1() override {} |
---|
| 100 | virtual void test2() override {} |
---|
[9646] | 101 | }; |
---|
| 102 | |
---|
[9639] | 103 | class Class2b : public BaseClass, public Interface2, Interface1 |
---|
[9646] | 104 | { |
---|
| 105 | public: |
---|
| 106 | Class2b() |
---|
| 107 | { |
---|
| 108 | RegisterObject(Class2b); |
---|
| 109 | } |
---|
[9639] | 110 | |
---|
[11071] | 111 | virtual void test1() override {} |
---|
| 112 | virtual void test2() override {} |
---|
[9646] | 113 | }; |
---|
| 114 | |
---|
[9639] | 115 | class Class3 : public BaseClass, public BaseInterface1, BaseInterface2 |
---|
[9646] | 116 | { |
---|
| 117 | public: |
---|
| 118 | Class3() |
---|
| 119 | { |
---|
| 120 | RegisterObject(Class3); |
---|
| 121 | } |
---|
[9639] | 122 | |
---|
[11071] | 123 | virtual void test1() override {} |
---|
| 124 | virtual void test2() override {} |
---|
[9646] | 125 | }; |
---|
| 126 | |
---|
[10624] | 127 | RegisterAbstractClass(BaseInterface1).inheritsFrom<OrxonoxInterface>(); |
---|
| 128 | RegisterAbstractClass(BaseInterface2).inheritsFrom<OrxonoxInterface>(); |
---|
| 129 | RegisterAbstractClass(Interface1).inheritsFrom<BaseInterface1>(); |
---|
| 130 | RegisterAbstractClass(Interface2).inheritsFrom<BaseInterface2>(); |
---|
| 131 | RegisterClassNoArgs(BaseClass); |
---|
| 132 | RegisterClassNoArgs(Class0); |
---|
| 133 | RegisterClassNoArgs(Class1); |
---|
| 134 | RegisterClassNoArgs(Class2a); |
---|
| 135 | RegisterClassNoArgs(Class2b); |
---|
| 136 | RegisterClassNoArgs(Class3); |
---|
| 137 | |
---|
[9639] | 138 | // Fixture |
---|
| 139 | class IdentifierClassHierarchyTest : public ::testing::Test |
---|
| 140 | { |
---|
| 141 | public: |
---|
[11071] | 142 | virtual void SetUp() override |
---|
[9639] | 143 | { |
---|
[10624] | 144 | new IdentifierManager(); |
---|
| 145 | ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); |
---|
[11071] | 146 | Context::setRootContext(new Context(nullptr)); |
---|
[10624] | 147 | Identifier::initConfigValues_s = false; // TODO: hack! |
---|
[9640] | 148 | IdentifierManager::getInstance().createClassHierarchy(); |
---|
[9639] | 149 | } |
---|
| 150 | |
---|
[11071] | 151 | virtual void TearDown() override |
---|
[9639] | 152 | { |
---|
[10624] | 153 | IdentifierManager::getInstance().destroyClassHierarchy(); |
---|
| 154 | Context::destroyRootContext(); |
---|
| 155 | ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER); |
---|
| 156 | delete &IdentifierManager::getInstance(); |
---|
[9639] | 157 | } |
---|
| 158 | }; |
---|
[9646] | 159 | |
---|
[10624] | 160 | bool contains(const std::list<const Identifier*> identifiers, Identifier* identifier) |
---|
[9646] | 161 | { |
---|
[10624] | 162 | return std::find(identifiers.begin(), identifiers.end(), identifier) != identifiers.end(); |
---|
[9646] | 163 | } |
---|
[9639] | 164 | |
---|
[10624] | 165 | bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier) |
---|
[9639] | 166 | { |
---|
[10624] | 167 | return identifiers.find(identifier) != identifiers.end(); |
---|
[9639] | 168 | } |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | TEST_F(IdentifierClassHierarchyTest, TestBaseInterface1) |
---|
| 172 | { |
---|
| 173 | Identifier* identifier = Class(BaseInterface1); |
---|
| 174 | |
---|
| 175 | EXPECT_EQ(2u, identifier->getDirectChildren().size()); |
---|
[9646] | 176 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Interface1))); |
---|
| 177 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3))); |
---|
| 178 | |
---|
[9639] | 179 | EXPECT_EQ(5u, identifier->getChildren().size()); |
---|
[9646] | 180 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Interface1))); |
---|
| 181 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3))); |
---|
| 182 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1))); |
---|
| 183 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
| 184 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
| 185 | |
---|
| 186 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
| 187 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxInterface))); |
---|
| 188 | |
---|
[9653] | 189 | EXPECT_EQ(4u, identifier->getParents().size()); |
---|
[9646] | 190 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 191 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 192 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 193 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
[9639] | 194 | } |
---|
| 195 | |
---|
| 196 | TEST_F(IdentifierClassHierarchyTest, TestBaseInterface2) |
---|
| 197 | { |
---|
| 198 | Identifier* identifier = Class(BaseInterface2); |
---|
| 199 | |
---|
| 200 | EXPECT_EQ(2u, identifier->getDirectChildren().size()); |
---|
[9646] | 201 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Interface2))); |
---|
| 202 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3))); |
---|
| 203 | |
---|
[9639] | 204 | EXPECT_EQ(4u, identifier->getChildren().size()); |
---|
[9646] | 205 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Interface2))); |
---|
| 206 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3))); |
---|
| 207 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
| 208 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
| 209 | |
---|
| 210 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
| 211 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxInterface))); |
---|
| 212 | |
---|
[9653] | 213 | EXPECT_EQ(4u, identifier->getParents().size()); |
---|
[9646] | 214 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 215 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 216 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 217 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
[9639] | 218 | } |
---|
| 219 | |
---|
| 220 | TEST_F(IdentifierClassHierarchyTest, TestInterface1) |
---|
| 221 | { |
---|
| 222 | Identifier* identifier = Class(Interface1); |
---|
| 223 | |
---|
| 224 | EXPECT_EQ(3u, identifier->getDirectChildren().size()); |
---|
[9646] | 225 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class1))); |
---|
| 226 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a))); |
---|
| 227 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b))); |
---|
| 228 | |
---|
[9639] | 229 | EXPECT_EQ(3u, identifier->getChildren().size()); |
---|
[9646] | 230 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1))); |
---|
| 231 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
| 232 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
| 233 | |
---|
[9639] | 234 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
[9646] | 235 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface1))); |
---|
| 236 | |
---|
[9653] | 237 | EXPECT_EQ(5u, identifier->getParents().size()); |
---|
[9646] | 238 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 239 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 240 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 241 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
| 242 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
[9639] | 243 | } |
---|
| 244 | |
---|
| 245 | TEST_F(IdentifierClassHierarchyTest, TestInterface2) |
---|
| 246 | { |
---|
| 247 | Identifier* identifier = Class(Interface2); |
---|
| 248 | |
---|
| 249 | EXPECT_EQ(2u, identifier->getDirectChildren().size()); |
---|
[9646] | 250 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a))); |
---|
| 251 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b))); |
---|
| 252 | |
---|
[9639] | 253 | EXPECT_EQ(2u, identifier->getChildren().size()); |
---|
[9646] | 254 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
| 255 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
| 256 | |
---|
[9639] | 257 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
[9646] | 258 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface2))); |
---|
| 259 | |
---|
[9653] | 260 | EXPECT_EQ(5u, identifier->getParents().size()); |
---|
[9646] | 261 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 262 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 263 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 264 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
| 265 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
[9639] | 266 | } |
---|
| 267 | |
---|
| 268 | TEST_F(IdentifierClassHierarchyTest, TestBaseClass) |
---|
| 269 | { |
---|
| 270 | Identifier* identifier = Class(BaseClass); |
---|
| 271 | |
---|
| 272 | EXPECT_EQ(5u, identifier->getDirectChildren().size()); |
---|
[9646] | 273 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class0))); |
---|
| 274 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class1))); |
---|
| 275 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a))); |
---|
| 276 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b))); |
---|
| 277 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3))); |
---|
| 278 | |
---|
[9639] | 279 | EXPECT_EQ(5u, identifier->getChildren().size()); |
---|
[9646] | 280 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class0))); |
---|
| 281 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1))); |
---|
| 282 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
| 283 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
| 284 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3))); |
---|
| 285 | |
---|
| 286 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
| 287 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxClass))); |
---|
| 288 | |
---|
[9653] | 289 | EXPECT_EQ(4u, identifier->getParents().size()); |
---|
[9646] | 290 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 291 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 292 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 293 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
[9639] | 294 | } |
---|
| 295 | |
---|
| 296 | TEST_F(IdentifierClassHierarchyTest, TestClass0) |
---|
| 297 | { |
---|
| 298 | Identifier* identifier = Class(Class0); |
---|
| 299 | |
---|
| 300 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
[9646] | 301 | |
---|
[9639] | 302 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
[9646] | 303 | |
---|
[9639] | 304 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
[9646] | 305 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
| 306 | |
---|
[9653] | 307 | EXPECT_EQ(5u, identifier->getParents().size()); |
---|
[9646] | 308 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 309 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 310 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 311 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
| 312 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
[9639] | 313 | } |
---|
| 314 | |
---|
| 315 | TEST_F(IdentifierClassHierarchyTest, TestClass1) |
---|
| 316 | { |
---|
| 317 | Identifier* identifier = Class(Class1); |
---|
| 318 | |
---|
| 319 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
[9646] | 320 | |
---|
[9639] | 321 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
[9646] | 322 | |
---|
[9639] | 323 | EXPECT_EQ(2u, identifier->getDirectParents().size()); |
---|
[9646] | 324 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
| 325 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1))); |
---|
| 326 | |
---|
[9653] | 327 | EXPECT_EQ(8u, identifier->getParents().size()); |
---|
[9646] | 328 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 329 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 330 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 331 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
| 332 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
| 333 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
| 334 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
| 335 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1))); |
---|
[9639] | 336 | } |
---|
| 337 | |
---|
| 338 | TEST_F(IdentifierClassHierarchyTest, TestClass2a) |
---|
| 339 | { |
---|
| 340 | Identifier* identifier = Class(Class2a); |
---|
| 341 | |
---|
| 342 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
[9646] | 343 | |
---|
[9639] | 344 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
[9646] | 345 | |
---|
[9639] | 346 | EXPECT_EQ(3u, identifier->getDirectParents().size()); |
---|
[9646] | 347 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
| 348 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1))); |
---|
| 349 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface2))); |
---|
| 350 | |
---|
[9653] | 351 | EXPECT_EQ(10u, identifier->getParents().size()); |
---|
[9646] | 352 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 353 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 354 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 355 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
| 356 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
| 357 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
| 358 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
| 359 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1))); |
---|
| 360 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
| 361 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface2))); |
---|
[9639] | 362 | } |
---|
| 363 | |
---|
| 364 | TEST_F(IdentifierClassHierarchyTest, TestClass2b) |
---|
| 365 | { |
---|
| 366 | Identifier* identifier = Class(Class2b); |
---|
| 367 | |
---|
| 368 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
[9646] | 369 | |
---|
[9639] | 370 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
[9646] | 371 | |
---|
[9639] | 372 | EXPECT_EQ(3u, identifier->getDirectParents().size()); |
---|
[9646] | 373 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
| 374 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1))); |
---|
| 375 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface2))); |
---|
| 376 | |
---|
[9653] | 377 | EXPECT_EQ(10u, identifier->getParents().size()); |
---|
[9646] | 378 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 379 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 380 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 381 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
| 382 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
| 383 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
| 384 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
| 385 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1))); |
---|
| 386 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
| 387 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface2))); |
---|
[9639] | 388 | } |
---|
| 389 | |
---|
| 390 | TEST_F(IdentifierClassHierarchyTest, TestClass3) |
---|
| 391 | { |
---|
| 392 | Identifier* identifier = Class(Class3); |
---|
| 393 | |
---|
| 394 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
[9646] | 395 | |
---|
[9639] | 396 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
[9646] | 397 | |
---|
[9639] | 398 | EXPECT_EQ(3u, identifier->getDirectParents().size()); |
---|
[9646] | 399 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
| 400 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface1))); |
---|
| 401 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface2))); |
---|
| 402 | |
---|
[9653] | 403 | EXPECT_EQ(8u, identifier->getParents().size()); |
---|
[9646] | 404 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
[9651] | 405 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
[9653] | 406 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
[9646] | 407 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
| 408 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
| 409 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
| 410 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
| 411 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
[9639] | 412 | } |
---|
| 413 | } |
---|