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