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