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