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() {} |
---|
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() {} |
---|
100 | virtual void test2() {} |
---|
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() {} |
---|
112 | virtual void test2() {} |
---|
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() {} |
---|
124 | virtual void test2() {} |
---|
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() |
---|
143 | { |
---|
144 | ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(); |
---|
145 | Identifier::initConfigValues_s = false; // TODO: hack! |
---|
146 | IdentifierManager::getInstance().createClassHierarchy(); |
---|
147 | } |
---|
148 | |
---|
149 | virtual void TearDown() |
---|
150 | { |
---|
151 | IdentifierManager::getInstance().destroyClassHierarchy(); |
---|
152 | ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(); |
---|
153 | } |
---|
154 | }; |
---|
155 | |
---|
156 | bool contains(const std::list<const Identifier*> identifiers, Identifier* identifier) |
---|
157 | { |
---|
158 | return std::find(identifiers.begin(), identifiers.end(), identifier) != identifiers.end(); |
---|
159 | } |
---|
160 | |
---|
161 | bool contains(const std::set<const Identifier*> identifiers, Identifier* identifier) |
---|
162 | { |
---|
163 | return identifiers.find(identifier) != identifiers.end(); |
---|
164 | } |
---|
165 | } |
---|
166 | |
---|
167 | TEST(IdentifierClassHierarchyTest_NoFixture, NoInitialization) |
---|
168 | { |
---|
169 | { |
---|
170 | Identifier* identifier = Class(BaseInterface1); |
---|
171 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
172 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
173 | } |
---|
174 | { |
---|
175 | Identifier* identifier = Class(BaseInterface2); |
---|
176 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
177 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
178 | } |
---|
179 | { |
---|
180 | Identifier* identifier = Class(Interface1); |
---|
181 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
182 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
183 | } |
---|
184 | { |
---|
185 | Identifier* identifier = Class(Interface2); |
---|
186 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
187 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
188 | } |
---|
189 | { |
---|
190 | Identifier* identifier = Class(BaseClass); |
---|
191 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
192 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
193 | } |
---|
194 | { |
---|
195 | Identifier* identifier = Class(Class0); |
---|
196 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
197 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
198 | } |
---|
199 | { |
---|
200 | Identifier* identifier = Class(Class1); |
---|
201 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
202 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
203 | } |
---|
204 | { |
---|
205 | Identifier* identifier = Class(Class2a); |
---|
206 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
207 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
208 | } |
---|
209 | { |
---|
210 | Identifier* identifier = Class(Class2b); |
---|
211 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
212 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
213 | } |
---|
214 | { |
---|
215 | Identifier* identifier = Class(Class3); |
---|
216 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
217 | EXPECT_EQ(0u, identifier->getParents().size()); |
---|
218 | } |
---|
219 | } |
---|
220 | |
---|
221 | TEST_F(IdentifierClassHierarchyTest, TestBaseInterface1) |
---|
222 | { |
---|
223 | Identifier* identifier = Class(BaseInterface1); |
---|
224 | |
---|
225 | EXPECT_EQ(2u, identifier->getDirectChildren().size()); |
---|
226 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Interface1))); |
---|
227 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3))); |
---|
228 | |
---|
229 | EXPECT_EQ(5u, identifier->getChildren().size()); |
---|
230 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Interface1))); |
---|
231 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3))); |
---|
232 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1))); |
---|
233 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
234 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
235 | |
---|
236 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
237 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxInterface))); |
---|
238 | |
---|
239 | EXPECT_EQ(4u, identifier->getParents().size()); |
---|
240 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
241 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
242 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
243 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
244 | } |
---|
245 | |
---|
246 | TEST_F(IdentifierClassHierarchyTest, TestBaseInterface2) |
---|
247 | { |
---|
248 | Identifier* identifier = Class(BaseInterface2); |
---|
249 | |
---|
250 | EXPECT_EQ(2u, identifier->getDirectChildren().size()); |
---|
251 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Interface2))); |
---|
252 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3))); |
---|
253 | |
---|
254 | EXPECT_EQ(4u, identifier->getChildren().size()); |
---|
255 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Interface2))); |
---|
256 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3))); |
---|
257 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
258 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
259 | |
---|
260 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
261 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxInterface))); |
---|
262 | |
---|
263 | EXPECT_EQ(4u, identifier->getParents().size()); |
---|
264 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
265 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
266 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
267 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
268 | } |
---|
269 | |
---|
270 | TEST_F(IdentifierClassHierarchyTest, TestInterface1) |
---|
271 | { |
---|
272 | Identifier* identifier = Class(Interface1); |
---|
273 | |
---|
274 | EXPECT_EQ(3u, identifier->getDirectChildren().size()); |
---|
275 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class1))); |
---|
276 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a))); |
---|
277 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b))); |
---|
278 | |
---|
279 | EXPECT_EQ(3u, identifier->getChildren().size()); |
---|
280 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1))); |
---|
281 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
282 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
283 | |
---|
284 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
285 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface1))); |
---|
286 | |
---|
287 | EXPECT_EQ(5u, identifier->getParents().size()); |
---|
288 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
289 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
290 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
291 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
292 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
293 | } |
---|
294 | |
---|
295 | TEST_F(IdentifierClassHierarchyTest, TestInterface2) |
---|
296 | { |
---|
297 | Identifier* identifier = Class(Interface2); |
---|
298 | |
---|
299 | EXPECT_EQ(2u, identifier->getDirectChildren().size()); |
---|
300 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a))); |
---|
301 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b))); |
---|
302 | |
---|
303 | EXPECT_EQ(2u, identifier->getChildren().size()); |
---|
304 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
305 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
306 | |
---|
307 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
308 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface2))); |
---|
309 | |
---|
310 | EXPECT_EQ(5u, identifier->getParents().size()); |
---|
311 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
312 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
313 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
314 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
315 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
316 | } |
---|
317 | |
---|
318 | TEST_F(IdentifierClassHierarchyTest, TestBaseClass) |
---|
319 | { |
---|
320 | Identifier* identifier = Class(BaseClass); |
---|
321 | |
---|
322 | EXPECT_EQ(5u, identifier->getDirectChildren().size()); |
---|
323 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class0))); |
---|
324 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class1))); |
---|
325 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2a))); |
---|
326 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class2b))); |
---|
327 | EXPECT_TRUE(contains(identifier->getDirectChildren(), Class(Class3))); |
---|
328 | |
---|
329 | EXPECT_EQ(5u, identifier->getChildren().size()); |
---|
330 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class0))); |
---|
331 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class1))); |
---|
332 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2a))); |
---|
333 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class2b))); |
---|
334 | EXPECT_TRUE(contains(identifier->getChildren(), Class(Class3))); |
---|
335 | |
---|
336 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
337 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(OrxonoxClass))); |
---|
338 | |
---|
339 | EXPECT_EQ(4u, identifier->getParents().size()); |
---|
340 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
341 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
342 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
343 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
344 | } |
---|
345 | |
---|
346 | TEST_F(IdentifierClassHierarchyTest, TestClass0) |
---|
347 | { |
---|
348 | Identifier* identifier = Class(Class0); |
---|
349 | |
---|
350 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
351 | |
---|
352 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
353 | |
---|
354 | EXPECT_EQ(1u, identifier->getDirectParents().size()); |
---|
355 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
356 | |
---|
357 | EXPECT_EQ(5u, identifier->getParents().size()); |
---|
358 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
359 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
360 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
361 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
362 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
363 | } |
---|
364 | |
---|
365 | TEST_F(IdentifierClassHierarchyTest, TestClass1) |
---|
366 | { |
---|
367 | Identifier* identifier = Class(Class1); |
---|
368 | |
---|
369 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
370 | |
---|
371 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
372 | |
---|
373 | EXPECT_EQ(2u, identifier->getDirectParents().size()); |
---|
374 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
375 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1))); |
---|
376 | |
---|
377 | EXPECT_EQ(8u, 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 | } |
---|
387 | |
---|
388 | TEST_F(IdentifierClassHierarchyTest, TestClass2a) |
---|
389 | { |
---|
390 | Identifier* identifier = Class(Class2a); |
---|
391 | |
---|
392 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
393 | |
---|
394 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
395 | |
---|
396 | EXPECT_EQ(3u, identifier->getDirectParents().size()); |
---|
397 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
398 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1))); |
---|
399 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface2))); |
---|
400 | |
---|
401 | EXPECT_EQ(10u, identifier->getParents().size()); |
---|
402 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
403 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
404 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
405 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
406 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
407 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
408 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
409 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1))); |
---|
410 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
411 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface2))); |
---|
412 | } |
---|
413 | |
---|
414 | TEST_F(IdentifierClassHierarchyTest, TestClass2b) |
---|
415 | { |
---|
416 | Identifier* identifier = Class(Class2b); |
---|
417 | |
---|
418 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
419 | |
---|
420 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
421 | |
---|
422 | EXPECT_EQ(3u, identifier->getDirectParents().size()); |
---|
423 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
424 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface1))); |
---|
425 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(Interface2))); |
---|
426 | |
---|
427 | EXPECT_EQ(10u, identifier->getParents().size()); |
---|
428 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
429 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
430 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
431 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
432 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
433 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
434 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
435 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface1))); |
---|
436 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
437 | EXPECT_TRUE(contains(identifier->getParents(), Class(Interface2))); |
---|
438 | } |
---|
439 | |
---|
440 | TEST_F(IdentifierClassHierarchyTest, TestClass3) |
---|
441 | { |
---|
442 | Identifier* identifier = Class(Class3); |
---|
443 | |
---|
444 | EXPECT_EQ(0u, identifier->getDirectChildren().size()); |
---|
445 | |
---|
446 | EXPECT_EQ(0u, identifier->getChildren().size()); |
---|
447 | |
---|
448 | EXPECT_EQ(3u, identifier->getDirectParents().size()); |
---|
449 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseClass))); |
---|
450 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface1))); |
---|
451 | EXPECT_TRUE(contains(identifier->getDirectParents(), Class(BaseInterface2))); |
---|
452 | |
---|
453 | EXPECT_EQ(8u, identifier->getParents().size()); |
---|
454 | EXPECT_TRUE(contains(identifier->getParents(), Class(Identifiable))); |
---|
455 | EXPECT_TRUE(contains(identifier->getParents(), Class(Listable))); |
---|
456 | EXPECT_TRUE(contains(identifier->getParents(), Class(Configurable))); |
---|
457 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxClass))); |
---|
458 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseClass))); |
---|
459 | EXPECT_TRUE(contains(identifier->getParents(), Class(OrxonoxInterface))); |
---|
460 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface1))); |
---|
461 | EXPECT_TRUE(contains(identifier->getParents(), Class(BaseInterface2))); |
---|
462 | } |
---|
463 | } |
---|