1 // Copyright (c) 2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <QANCollection.hxx>
17 #include <Draw_Interpretor.hxx>
19 #include <Message_Status.hxx>
20 #include <NCollection_StdAllocator.hxx>
21 #include <NCollection_IncAllocator.hxx>
22 #include <NCollection_HeapAllocator.hxx>
23 #include <OSD_Timer.hxx>
24 #include <Standard_Assert.hxx>
25 #include <Standard_DefineHandle.hxx>
26 #include <Standard_Transient.hxx>
27 #include <TCollection_AsciiString.hxx>
28 #include <Geom_Circle.hxx>
29 #include <Geom_Line.hxx>
30 #include <Geom_BSplineCurve.hxx>
31 #include <Geom_Surface.hxx>
37 // auxiliary macro to check and report status
38 #define CHECK(di,ok,what) di << "Checking " << what << (ok ? ": OK\n" : ": Error\n")
40 //=======================================================================
41 //function : QAHandleOps
42 //purpose : Test Handle operations (mostly compile-time checks)
43 //=======================================================================
45 // set of overloaded functions for checking resolution of arguments
46 inline void f (const Handle(Geom_Curve)&) {}
47 inline void func (const Handle(Geom_Curve)&) {}
48 inline void func (const Handle(Geom_BSplineCurve)&) {}
49 inline void func (const Handle(Geom_Surface)&) {}
50 inline void func (const Handle(gp_Pnt)&) {}
51 inline void func (const Handle(gp_XYZ)&) {}
52 inline void func (const Handle(gp_Trsf)&) {}
54 static Standard_Integer QAHandleOps (Draw_Interpretor& theDI,
55 Standard_Integer /*theArgNb*/,
56 const char** /*theArgVec*/)
58 // ===============================================================
59 // Part 1: classes inheriting transient
60 // ===============================================================
62 Handle(Geom_Line) aLine = new Geom_Line (gp::Origin(), gp::DZ());
63 CHECK(theDI, ! aLine.IsNull(), "handle for non-null");
65 const Handle(Geom_Line)& cLine = aLine; // cast to self const ref
66 const Handle(Geom_Curve)& cCurve = aLine; // cast to base const ref
67 Geom_Line* pLine = aLine.get();
68 const Geom_Line* cpLine = aLine.get();
69 Geom_Line& rLine = *aLine;
70 const Geom_Line& crLine = *cLine;
71 Handle(Geom_Curve) aCurve = aLine; // copy from handle to derived type
72 aCurve = cLine; // assignment to handle of derived type
73 Handle(Geom_Line) dLine (cpLine); // copy from handle to derived type
75 aLine = Handle(Geom_Line)::DownCast (cCurve);
76 CHECK(theDI, ! aLine.IsNull(), "down cast");
78 // comparison operators
79 CHECK(theDI, aLine == aLine, "equality of handle to itself");
80 CHECK(theDI, cLine == cLine, "equality of const handle to itself");
81 CHECK(theDI, aLine == cLine, "equality of const and non-const handle");
82 CHECK(theDI, aLine == cCurve, "equality of handle and base handle");
83 CHECK(theDI, aLine == pLine, "equality of handle and pointer");
84 CHECK(theDI, pLine == aLine, "equality of pointer and handle");
85 CHECK(theDI, aLine == cpLine, "equality of handle and const pointer");
86 CHECK(theDI, cpLine == aLine, "equality of const pointer and handle");
87 CHECK(theDI, &rLine == aLine, "equality of reference and handle");
88 CHECK(theDI, &crLine == aLine, "equality of reference and handle");
89 CHECK(theDI, aLine, "cast to bool");
91 Handle(Geom_Line) aLin2;
92 CHECK(theDI, aLine != aLin2, "inequality of handle to the same type handle");
93 CHECK(theDI, aLin2 != cLine, "inequality of const and non-const handle");
94 CHECK(theDI, aLin2 != cCurve, "inequality of handle and base handle");
95 CHECK(theDI, aLin2 != pLine, "inequality of handle and pointer");
96 CHECK(theDI, pLine != aLin2, "inequality of pointer and handle");
97 CHECK(theDI, aLin2 != cpLine, "inequality of handle and const pointer");
98 CHECK(theDI, cpLine != aLin2, "inequality of const pointer and handle");
100 Handle(Geom_Curve) aCur2;
101 CHECK(theDI, aLine != aCur2, "inequality of handles of different types");
102 CHECK(theDI, aCur2 != cLine, "inequality of const and non-const handle");
103 CHECK(theDI, aCur2 != cCurve, "inequality of handle and base handle");
104 CHECK(theDI, aCur2 != pLine, "inequality of handle and pointer");
105 CHECK(theDI, pLine != aCur2, "inequality of pointer and handle");
106 CHECK(theDI, aCur2 != cpLine, "inequality of handle and const pointer");
107 CHECK(theDI, cpLine != aCur2, "inequality of const pointer and handle");
109 // passing handle as reference to base class
112 // passing handle to overloaded function accepting handle to another type
113 // will fail on VC below 12 and GCC below 4.3 due to ambiguity of overloads
114 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) || (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
119 const Handle(Geom_Curve)& aCurve2 = aLine; // cast to base const ref
121 Handle(Geom_Line) qLine = cpLine; // constructor from const pointer -- could be made explicit...
123 // check whether compiler will destroy reference to temporary handle
124 const Handle(Geom_Curve)& aTmpRef (Handle(Geom_Line)::DownCast (aCurve2));
125 CHECK(theDI, ! aTmpRef.IsNull(), "local reference of handle to base type to temporary handle object");
127 // check operations with Handle_* classes
128 Handle(Geom_Line) hLine = aLine;
129 CHECK(theDI, ! hLine.IsNull(), "hhandle for non-null");
131 const Handle_Geom_Line& chLine = aLine; // cast to self const ref
132 const Handle_Geom_Curve& chCurve = aLine; // cast to base const ref
133 const Handle_Geom_Line& hhLine = hLine; // cast to self const ref
134 const Handle_Geom_Curve& hhCurve = hLine; // cast to base const ref
135 Handle_Geom_Curve hCurve = aLine; // copy from handle to derived type
136 Handle_Geom_Line phLine (aLine.get()); // construct from pointer
138 hLine = Handle_Geom_Line::DownCast (cCurve); // inheritance of downcast
139 CHECK(theDI, ! hLine.IsNull(), "down cast");
141 // comparison operators
142 CHECK(theDI, hLine == hLine, "equality of hhandle to itself");
143 CHECK(theDI, hLine == aLine, "equality of hhandle to handle");
144 CHECK(theDI, hhLine == hLine, "equality of hhandle to const");
145 CHECK(theDI, chLine == hLine, "equality of hhandle to const");
146 CHECK(theDI, hhCurve == hLine, "equality of hhandle to const");
147 CHECK(theDI, chCurve == hLine, "equality of hhandle to const");
148 CHECK(theDI, hLine, "cast to bool");
150 // passing hhandle as reference to base class
153 // passing handle to overloaded function accepting handle to another type
154 // will fail on VC below 12 and GCC below 4.3 due to ambiguity of overloads
155 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800) || (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
160 Handle_Geom_Line qhLine = cpLine; // constructor from const pointer -- could be made explicit...
162 // check whether compiler will destroy reference to temporary handle
163 const Handle_Geom_Curve& hTmpRef (Handle(Geom_Line)::DownCast (aCurve2));
164 CHECK(theDI, ! hTmpRef.IsNull(), "local reference of handle to base type to temporary handle object");
166 Handle(Geom_Surface) aSurf;
170 // each test in this section must cause compiler error
171 gunc (cLine); // passing const handle as non-const reference to base type
172 pLine = cLine.get(); // getting non-const pointer to contained object from const handle
173 Handle(Geom_Line) xLine = cCurve; // copy from handle to base type
174 Handle(Geom_BSplineCurve) aBSpl (new Geom_Line (gp::Origin(), gp::DX())); // construction from pointer to incompatible type
176 CHECK(theDI, aLine == aSurf, "equality of handles of incompatible types");
177 CHECK(theDI, aSurf == cLine, "equality of const and non-const handle");
178 CHECK(theDI, aSurf == cCurve, "equality of handle and base handle");
179 CHECK(theDI, aSurf == pLine, "equality of handle and pointer");
180 CHECK(theDI, pLine == aSurf, "equality of pointer and handle");
181 CHECK(theDI, aSurf == cpLine, "equality of handle and const pointer");
182 CHECK(theDI, cpLine != aSurf, "equality of const pointer and handle");
184 CHECK(theDI, aLine != aSurf, "inequality of handles of incompatible types");
185 CHECK(theDI, aSurf != cLine, "inequality of const and non-const handle");
186 CHECK(theDI, aSurf != cCurve, "inequality of handle and base handle");
187 CHECK(theDI, aSurf != pLine, "inequality of handle and pointer");
188 CHECK(theDI, pLine != aSurf, "inequality of pointer and handle");
189 CHECK(theDI, aSurf != cpLine, "inequality of handle and const pointer");
190 CHECK(theDI, cpLine != aSurf, "inequality of const pointer and handle");
193 // ===============================================================
194 // Part 2: classes not inheriting transient
195 // ===============================================================
197 Handle(gp_Pnt) aPnt = new gp_Pnt (gp::Origin());
198 CHECK(theDI, ! aPnt.IsNull(), "handle for non-null");
200 const Handle(gp_Pnt)& cPnt = aPnt; // cast to self const ref
201 // const Handle(gp_XYZ)& cXYZ = aPnt; // cast to base const ref
202 gp_Pnt* pPnt = aPnt.get();
203 const gp_Pnt* cpPnt = aPnt.get();
204 gp_Pnt& rPnt = *aPnt;
205 const gp_Pnt& crPnt = *cPnt;
206 // Handle(gp_XYZ) aXYZ = aPnt; // copy from handle to derived type
207 // aXYZ = cPnt; // assignment to handle of derived type
209 // aPnt = Handle(gp_Pnt)::DownCast (cXYZ);
210 // CHECK(theDI, ! aPnt.IsNull(), "down cast");
212 // comparison operators
213 CHECK(theDI, aPnt == aPnt, "equality of handle to itself");
214 CHECK(theDI, cPnt == cPnt, "equality of const handle to itself");
215 CHECK(theDI, aPnt == cPnt, "equality of const and non-const handle");
216 // CHECK(theDI, aPnt == cXYZ, "equality of handle and base handle");
217 CHECK(theDI, aPnt == pPnt, "equality of handle and pointer");
218 CHECK(theDI, pPnt == aPnt, "equality of pointer and handle");
219 CHECK(theDI, aPnt == cpPnt, "equality of handle and const pointer");
220 CHECK(theDI, cpPnt == aPnt, "equality of const pointer and handle");
221 CHECK(theDI, &rPnt == aPnt, "equality of reference and handle");
222 CHECK(theDI, &crPnt == aPnt, "equality of reference and handle");
224 Handle(gp_Pnt) aPnt2;
225 CHECK(theDI, aPnt != aPnt2, "inequality of handle to the same type handle");
226 CHECK(theDI, aPnt2 != cPnt, "inequality of const and non-const handle");
227 // CHECK(theDI, aPnt2 != cXYZ, "inequality of handle and base handle");
228 CHECK(theDI, aPnt2 != pPnt, "inequality of handle and pointer");
229 CHECK(theDI, pPnt != aPnt2, "inequality of pointer and handle");
230 CHECK(theDI, aPnt2 != cpPnt, "inequality of handle and const pointer");
231 CHECK(theDI, cpPnt != aPnt2, "inequality of const pointer and handle");
233 Handle(gp_XYZ) aXYZ2;
234 CHECK(theDI, aLine != aPnt2, "inequality of handles of different types");
235 CHECK(theDI, aXYZ2 != cPnt, "inequality of const and non-const handle");
236 // CHECK(theDI, aXYZ2 != cXYZ, "inequality of handle and base handle");
237 // CHECK(theDI, aXYZ2 != pPnt, "inequality of handle and pointer");
238 // CHECK(theDI, pPnt != aXYZ2, "inequality of pointer and handle");
239 // CHECK(theDI, aXYZ2 != cpPnt, "inequality of handle and const pointer");
240 // CHECK(theDI, cpPnt != aXYZ2, "inequality of const pointer and handle");
242 // passing handle as reference to base class
249 //=======================================================================
250 //function : QAHandleBool
251 //purpose : Test Handle -> bool conversion
252 //=======================================================================
253 static Standard_Integer QAHandleBool (Draw_Interpretor& theDI,
254 Standard_Integer /*theArgNb*/,
255 const char** /*theArgVec*/)
257 Handle(NCollection_BaseAllocator) aPtr = new NCollection_IncAllocator();
259 Handle(NCollection_IncAllocator) anInc = Handle(NCollection_IncAllocator)::DownCast (aPtr);
260 CHECK (theDI, ! anInc.IsNull(), "cast to NCollection_IncAllocator");
262 Handle(NCollection_BaseAllocator) anAlloc = aPtr;
263 CHECK (theDI, ! anAlloc.IsNull(), "cast to NCollection_BaseAllocator");
265 Handle(NCollection_HeapAllocator) aHAlloc = Handle(NCollection_HeapAllocator)::DownCast (aPtr);
266 CHECK (theDI, aHAlloc.IsNull(), "cast to NCollection_HeapAllocator");
271 // Auxiliary class to define new virtual methods
272 class Transient_Root : public Standard_Transient
275 virtual const char* Name() const { return "Transient_Root"; }
276 virtual Standard_Transient* CreateParent() const { return new Standard_Transient; }
277 virtual Standard_Transient* Clone() const { return new Transient_Root; }
278 DEFINE_STANDARD_RTTI_INLINE(Transient_Root,Standard_Transient)
280 DEFINE_STANDARD_HANDLE(Transient_Root, Standard_Transient)
282 // Auxiliary macros to create hierarchy of 50 classes
283 #define QA_DEFINECLASS(theClass, theParent) \
284 class theClass : public theParent \
287 virtual const char* Name() const Standard_OVERRIDE { return #theClass; } \
288 virtual Standard_Transient* CreateParent() const Standard_OVERRIDE { return new theParent(); } \
289 virtual Standard_Transient* Clone() const Standard_OVERRIDE { return new theClass(); } \
290 DEFINE_STANDARD_RTTI_INLINE(theClass,theParent) \
292 DEFINE_STANDARD_HANDLE (theClass, theParent)
294 #define QA_NAME(theNum) qaclass ## theNum ## _ ## 50
295 #define QA_HANDLE_NAME(theNum) Handle(qaclass ## theNum ## _ ## 50)
297 #define QA_DEFINECLASS10(theParent, theTens) \
298 QA_DEFINECLASS(QA_NAME(theTens ## 0), theParent) \
299 QA_DEFINECLASS(QA_NAME(theTens ## 1), QA_NAME(theTens ## 0)) \
300 QA_DEFINECLASS(QA_NAME(theTens ## 2), QA_NAME(theTens ## 1)) \
301 QA_DEFINECLASS(QA_NAME(theTens ## 3), QA_NAME(theTens ## 2)) \
302 QA_DEFINECLASS(QA_NAME(theTens ## 4), QA_NAME(theTens ## 3)) \
303 QA_DEFINECLASS(QA_NAME(theTens ## 5), QA_NAME(theTens ## 4)) \
304 QA_DEFINECLASS(QA_NAME(theTens ## 6), QA_NAME(theTens ## 5)) \
305 QA_DEFINECLASS(QA_NAME(theTens ## 7), QA_NAME(theTens ## 6)) \
306 QA_DEFINECLASS(QA_NAME(theTens ## 8), QA_NAME(theTens ## 7)) \
307 QA_DEFINECLASS(QA_NAME(theTens ## 9), QA_NAME(theTens ## 8))
309 QA_DEFINECLASS10(Transient_Root, 0)
310 QA_DEFINECLASS10(qaclass09_50, 1)
311 QA_DEFINECLASS10(qaclass19_50, 2)
312 QA_DEFINECLASS10(qaclass29_50, 3)
313 QA_DEFINECLASS10(qaclass39_50, 4)
314 QA_DEFINECLASS (qaclass50_50, qaclass49_50)
318 class qaclass50_50ANON : public qaclass49_50
321 qaclass50_50ANON() {}
325 namespace QaNamespace
327 class qaclass50_50 : public qaclass49_50
335 //! Timer sentry. Prints elapsed time information at destruction time.
336 class QATimer : public OSD_Timer
351 //! Main constructor - automatically starts the timer.
352 QATimer (Draw_Interpretor& theDI,
353 Standard_CString theTitle,
354 const TimeFormat theFormat,
355 const Standard_Integer theNbIters = 1,
356 const Standard_Boolean theToPrintFormat = Standard_False)
359 myFormat (theFormat),
360 myNbIters (theNbIters),
361 myToPrintFormat (theToPrintFormat)
366 //! Destructor - stops the timer and prints statistics.
377 (*myDI) << ElapsedTime() / Standard_Real(myNbIters);
384 (*myDI) << (ElapsedTime() / Standard_Real(myNbIters)) * 1000.0;
391 (*myDI) << (ElapsedTime() / Standard_Real(myNbIters)) * 1000000.0;
394 (*myDI) << " microseconds";
398 (*myDI) << (ElapsedTime() / Standard_Real(myNbIters)) * 1000000000.0;
408 Draw_Interpretor* myDI;
409 Standard_CString myTitle; //!< timer description
410 TimeFormat myFormat; //!< time format
411 Standard_Integer myNbIters; //!< iterations number
412 Standard_Boolean myToPrintFormat; //!< add time format
414 } // anonymous namespace
416 //=======================================================================
417 //function : QAHandleInc
418 //purpose : Estimate the smart-pointer counter incrementing time
419 //=======================================================================
420 static Standard_Integer QAHandleInc (Draw_Interpretor& theDI,
421 Standard_Integer theArgNb,
422 const char** theArgVec)
426 std::cout << "Error: wrong syntax! See usage:\n";
427 theDI.PrintHelp (theArgVec[0]);
430 const Standard_Integer aNbIters = (theArgNb > 1) ? Draw::Atoi (theArgVec[1]) : 10000000;
433 std::cout << "Error: number of iterations should be positive!\n";
437 Handle(Standard_Transient) aHandle = new Standard_Transient();
438 opencascade::std::shared_ptr<Standard_Transient> aSharePtr (new Standard_Transient());
439 theDI << "Time of creating and destroying " << aNbIters << " smart pointers to the same object, per item, ns:";
442 QATimer aTimer (theDI, "\nOCCT Handle: ", QATimer::ns, aNbIters);
444 std::vector<Handle(Standard_Transient)> aHandles (aNbIters);
445 for (Standard_Integer anIter = 0; anIter < aNbIters; ++anIter)
447 aHandles[anIter] = aHandle;
452 QATimer aTimer (theDI, "\nC++ shared_ptr: ", QATimer::ns, aNbIters);
454 std::vector< opencascade::std::shared_ptr<Standard_Transient> > aSharePointers (aNbIters);
455 for (Standard_Integer anIter = 0; anIter < aNbIters; ++anIter)
457 aSharePointers[anIter] = aSharePtr;
465 //=======================================================================
466 //function : QAHandleKind
468 //=======================================================================
469 static Standard_Integer QAHandleKind (Draw_Interpretor& /*theDI*/,
470 Standard_Integer /*theArgNb*/,
471 const char** /*theArgVec*/)
473 Handle(Standard_Type) aType00 = STANDARD_TYPE(qaclass00_50);
474 Handle(Standard_Type) aType10 = STANDARD_TYPE(qaclass10_50);
475 Handle(Standard_Type) aType20 = STANDARD_TYPE(qaclass20_50);
476 Handle(Standard_Type) aType30 = STANDARD_TYPE(qaclass30_50);
477 Handle(Standard_Type) aType40 = STANDARD_TYPE(qaclass40_50);
478 Handle(Standard_Type) aType50 = STANDARD_TYPE(qaclass50_50);
480 Handle(qaclass00_50) aHandle = new qaclass40_50();
482 #define QA_CHECK(theDesc, theExpr, theValue) \
484 const bool isTrue = !!(theExpr); \
485 std::cout << theDesc << (isTrue ? " TRUE " : " FALSE ") << (isTrue == theValue ? " is OK\n" : " is Error\n"); \
488 std::cout << "Check instance of " << aHandle->DynamicType()->Name() << "\n";
489 for (Handle(Standard_Type) aType = aHandle->DynamicType(); ! aType.IsNull(); aType = aType->Parent())
491 std::cout << " - " << aType->Name() << "\n";
494 QA_CHECK ("Name == qaclass40_50 : ", TCollection_AsciiString("qaclass40_50") == aHandle->DynamicType()->Name(), true);
496 QA_CHECK ("IsKind (aType00) : ", aHandle->IsKind (aType00), true);
497 QA_CHECK ("IsKind (aType10) : ", aHandle->IsKind (aType10), true);
498 QA_CHECK ("IsKind (aType20) : ", aHandle->IsKind (aType20), true);
499 QA_CHECK ("IsKind (aType30) : ", aHandle->IsKind (aType30), true);
500 QA_CHECK ("IsKind (aType40) : ", aHandle->IsKind (aType40), true);
501 QA_CHECK ("IsKind (aType50) : ", aHandle->IsKind (aType50), false);
503 QA_CHECK ("IsKind (\"qaclass00_50\"): ", aHandle->IsKind ("qaclass00_50"), true);
504 QA_CHECK ("IsKind (\"qaclass10_50\"): ", aHandle->IsKind ("qaclass10_50"), true);
505 QA_CHECK ("IsKind (\"qaclass20_50\"): ", aHandle->IsKind ("qaclass20_50"), true);
506 QA_CHECK ("IsKind (\"qaclass30_50\"): ", aHandle->IsKind ("qaclass30_50"), true);
507 QA_CHECK ("IsKind (\"qaclass40_50\"): ", aHandle->IsKind ("qaclass40_50"), true);
508 QA_CHECK ("IsKind (\"qaclass50_50\"): ", aHandle->IsKind ("qaclass50_50"), false);
510 QA_CHECK ("IsInstance (aType00) : ", aHandle->IsInstance (aType00), false);
511 QA_CHECK ("IsInstance (aType10) : ", aHandle->IsInstance (aType10), false);
512 QA_CHECK ("IsInstance (aType20) : ", aHandle->IsInstance (aType20), false);
513 QA_CHECK ("IsInstance (aType30) : ", aHandle->IsInstance (aType30), false);
514 QA_CHECK ("IsInstance (aType40) : ", aHandle->IsInstance (aType40), true);
515 QA_CHECK ("IsInstance (aType50) : ", aHandle->IsInstance (aType50), false);
518 std::cout << "\nC++11:\n";
519 std::type_index aCppType = typeid(*aHandle.operator->());
520 std::cout << "typeid().name() = '" << typeid(*aHandle.operator->()).name() << "'\n";
522 std::cout << "typeid().raw_name()= '" << typeid(*aHandle.operator->()).raw_name() << "'\n";
525 std::cout << "[ANON]typeid().name() = '" << typeid(qaclass50_50ANON).name() << "'\n";
527 std::cout << "[ANON]typeid().raw_name()= '" << typeid(qaclass50_50ANON).raw_name() << "'\n";
530 std::cout << "[NS]typeid().name() = '" << typeid(QaNamespace::qaclass50_50).name() << "'\n";
532 std::cout << "[NS]typeid().raw_name()= '" << typeid(QaNamespace::qaclass50_50).raw_name() << "'\n";
535 QA_CHECK ("is typeid (aType00) : ", typeid(*aHandle.operator->()) == typeid(qaclass00_50), false);
536 QA_CHECK ("is typeid (aType10) : ", typeid(*aHandle.operator->()) == typeid(qaclass10_50), false);
537 QA_CHECK ("is typeid (aType20) : ", typeid(*aHandle.operator->()) == typeid(qaclass20_50), false);
538 QA_CHECK ("is typeid (aType30) : ", typeid(*aHandle.operator->()) == typeid(qaclass30_50), false);
539 QA_CHECK ("is typeid (aType40) : ", typeid(*aHandle.operator->()) == typeid(qaclass40_50), true);
540 QA_CHECK ("is typeid (aType50) : ", typeid(*aHandle.operator->()) == typeid(qaclass50_50), false);
542 QA_CHECK ("is type_index (aType00) : ", aCppType == typeid(qaclass00_50), false);
543 QA_CHECK ("is type_index (aType40) : ", aCppType == typeid(qaclass40_50), true);
545 QA_CHECK ("IsClass(Standard_Transient): ", std::is_class<Standard_Transient>::value == !!STANDARD_TYPE(Standard_Transient)->IsClass(), true);
546 //QA_CHECK ("IsEnum (Message_Status) : ", std::is_enum<Message_Status>::value == !!STANDARD_TYPE(Message_Status)->IsEnumeration(), true);
552 void QANCollection::CommandsHandle (Draw_Interpretor& theCommands)
554 const char* THE_GROUP = "QANCollection";
555 theCommands.Add ("QAHandleBool",
556 "Test handle boolean operator",
557 __FILE__, QAHandleBool, THE_GROUP);
558 theCommands.Add ("QAHandleInc",
559 "QAHandleInc nbIter=1000000"
560 "\n\t\t: Test handle increment performance",
561 __FILE__, QAHandleInc, THE_GROUP);
562 theCommands.Add ("QAHandleKind",
563 "Test handle IsKind",
564 __FILE__, QAHandleKind, THE_GROUP);
565 theCommands.Add ("QAHandleOps",
566 "Test handle operations",
567 __FILE__, QAHandleOps, THE_GROUP);