1 // Created on: 2002-05-21
2 // Created by: QA Admin
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
23 #include <Draw_Interpretor.hxx>
25 #include <DrawTrSurf.hxx>
26 #include <AIS_InteractiveContext.hxx>
27 #include <ViewerTest.hxx>
28 #include <AIS_Shape.hxx>
29 #include <TopoDS_Shape.hxx>
31 #include <gp_Pnt2d.hxx>
33 #include <GCE2d_MakeSegment.hxx>
34 #include <Geom2d_TrimmedCurve.hxx>
35 #include <DrawTrSurf.hxx>
37 #include <Precision.hxx>
39 #include <PCollection_HAsciiString.hxx>
44 #include <OSD_PerfMeter.hxx>
45 #include <OSD_Timer.hxx>
46 #include <BRepPrimAPI_MakeBox.hxx>
47 #include <BRepPrimAPI_MakeSphere.hxx>
48 #include <BRepAlgo_Cut.hxx>
50 #include <TCollection_HAsciiString.hxx>
52 #define QCOMPARE(val1, val2) \
53 di << "Checking " #val1 " == " #val2 << \
54 ((val1) == (val2) ? ": OK\n" : ": Error\n")
56 static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
59 di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
64 if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
65 di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
68 if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
69 di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
73 GCE2d_MakeSegment MakeSegment(P1,P2);
74 Handle(Geom2d_TrimmedCurve) TrimmedCurve = MakeSegment.Value();
75 DrawTrSurf::Set(argv[1], TrimmedCurve);
79 static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
81 for(Standard_Integer i= 0;i <= 20;i++){
82 Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
85 di << "OCC142: OK" << "\n";
89 static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
94 t1.SetRotation(gp_Ax1(p, gp_Dir(0, 1, 0)), -0.49328285294022267);
95 t2.SetRotation(gp_Ax1(p, gp_Dir(0, 0, 1)), 0.87538474718473880);
97 gp_Trsf tComp = t2 * t1;
100 gp_Pnt p2 = p1.Transformed(tComp);
101 gp_Pnt p3 = p1.Transformed(t1);
104 // points must be equal
105 if ( ! p2.IsEqual(p3, Precision::Confusion()) )
106 di << "ERROR OCC23361: equivalent transformations does not produce equal points" << "\n";
108 di << "OCC23361: OK" << "\n";
113 static Standard_Integer OCC23237 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
115 OSD_PerfMeter aPM("TestMeter",0);
118 // run some operation in cycle for about 2 seconds to have good values of times to compare
120 printf("OSD_PerfMeter test.\nRunning Boolean operation on solids in loop.\n");
121 for (; aTM.ElapsedTime() < 2.; count++)
126 // do some operation that will take considerable time compared with time or starting / stopping timers
127 BRepPrimAPI_MakeBox aBox (10., 10., 10.);
128 BRepPrimAPI_MakeSphere aSphere (10.);
129 BRepAlgo_Cut (aBox.Shape(), aSphere.Shape());
136 Standard_Real aPerfMeter_CPUtime = 0., aTimer_ElapsedTime = aTM.ElapsedTime();
138 perf_get_meter("TestMeter", &aNbEnters, &aPerfMeter_CPUtime);
140 Standard_Real aTimeDiff = (fabs(aTimer_ElapsedTime - aPerfMeter_CPUtime) / aTimer_ElapsedTime);
142 printf("\nMeasurement results (%d cycles):\n", count);
143 printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer elapsed time: %lf\n", aPerfMeter_CPUtime, aTimer_ElapsedTime);
144 printf("Time delta is: %.3lf %%\n", aTimeDiff * 100);
147 di << "OCC23237: Error: too much difference between CPU and elapsed times";
148 else if (aNbEnters != count)
149 di << "OCC23237: Error: counter reported by PerfMeter (" << aNbEnters << ") does not correspond to actual number of cycles";
151 di << "OCC23237: OK";
158 #include <Standard_Atomic.hxx>
159 #include <tbb/blocked_range.h>
160 #include <tbb/parallel_for.h>
162 class IncrementerDecrementer
165 IncrementerDecrementer (Standard_Integer* theVal, Standard_Boolean thePositive) : myVal (theVal), myPositive (thePositive)
167 void operator() (const tbb::blocked_range<size_t>& r) const
170 for (size_t i = r.begin(); i != r.end(); ++i)
171 Standard_Atomic_Increment (myVal);
173 for (size_t i = r.begin(); i != r.end(); ++i)
174 Standard_Atomic_Decrement (myVal);
177 Standard_Integer* myVal;
178 Standard_Boolean myPositive;
183 static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
187 //check returned value
188 QCOMPARE (Standard_Atomic_Decrement (&aSum), -1);
189 QCOMPARE (Standard_Atomic_Increment (&aSum), 0);
190 QCOMPARE (Standard_Atomic_Increment (&aSum), 1);
191 QCOMPARE (Standard_Atomic_Increment (&aSum), 2);
192 // QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 0);
193 // QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 1);
197 const int N = 1 << 24; //big enough to ensure concurrency
200 tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, true));
204 tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, false));
212 static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char **argv)
214 di << "Test skipped: command " << argv[0] << " requires TBB library\n";
218 #endif /* HAVE_TBB */
220 #include <TDocStd_Application.hxx>
221 #include <XCAFApp_Application.hxx>
222 #include <TDocStd_Document.hxx>
223 #include <XCAFDoc_ShapeTool.hxx>
224 #include <XCAFDoc_DocumentTool.hxx>
225 #include <TDF_Label.hxx>
226 #include <TDataStd_Name.hxx>
228 static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
230 const Handle(TDocStd_Application)& anApp = XCAFApp_Application::GetApplication();
231 Handle(TDocStd_Document) aDoc;
232 anApp->NewDocument ("XmlXCAF", aDoc);
233 QCOMPARE (!aDoc.IsNull(), Standard_True);
235 Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
237 //check default value
238 Standard_Boolean aValue = XCAFDoc_ShapeTool::AutoNaming();
239 QCOMPARE (aValue, Standard_True);
242 XCAFDoc_ShapeTool::SetAutoNaming (Standard_True);
243 TopoDS_Shape aShape = BRepPrimAPI_MakeBox (100., 200., 300.).Shape();
244 TDF_Label aLabel = aShTool->AddShape (aShape);
245 Handle(TDataStd_Name) anAttr;
246 QCOMPARE (aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
249 XCAFDoc_ShapeTool::SetAutoNaming (Standard_False);
250 aShape = BRepPrimAPI_MakeBox (300., 200., 100.).Shape();
251 aLabel = aShTool->AddShape (aShape);
252 QCOMPARE (!aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
255 XCAFDoc_ShapeTool::SetAutoNaming (aValue);
260 #include <ExprIntrp_GenExp.hxx>
261 Standard_Integer OCC22611 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
265 di << "Usage : " << argv[0] << " string nb\n";
269 TCollection_AsciiString aToken = argv[1];
270 Standard_Integer aNb = atoi(argv[2]);
272 Handle(ExprIntrp_GenExp) aGen = ExprIntrp_GenExp::Create();
273 for (Standard_Integer i=0; i < aNb; i++)
275 aGen->Process(aToken);
276 Handle(Expr_GeneralExpression) aExpr = aGen->Expression();
282 Standard_Integer OCC22595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
286 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}"
287 << " {" << M0(2,1) << "} {" << M0(2,2) << "} {" << M0(2,3) <<"}"
288 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}";
292 #include <TopoDS_Face.hxx>
293 #include <TopoDS_Face.hxx>
294 #include <TopoDS.hxx>
295 #include <BRepBuilderAPI_Transform.hxx>
296 #include <BRepExtrema_DistShapeShape.hxx>
297 #include <BRepTools.hxx>
299 Standard_Boolean static OCC23774Test(const TopoDS_Face& grossPlateFace, const TopoDS_Shape& originalWire, Draw_Interpretor& di)
301 BRepExtrema_DistShapeShape distShapeShape(grossPlateFace,originalWire,Extrema_ExtFlag_MIN);
302 if(!distShapeShape.IsDone()) {
303 di <<"Distance ShapeShape is Not Done\n";
304 return Standard_False;
307 if(distShapeShape.Value() > 0.01) {
308 di << "Wrong Dist = " <<distShapeShape.Value() << "\n";
309 return Standard_False;
311 di << "Dist0 = " <<distShapeShape.Value() <<"\n";
313 //////////////////////////////////////////////////////////////////////////
315 const gp_Pnt2d axis1P1(1474.8199035519228,1249.9995745636970);
316 const gp_Pnt2d axis1P2(1474.8199035519228,1250.9995745636970);
318 gp_Vec2d mirrorVector1(axis1P1,axis1P2);
321 mirror1.SetMirror(gp_Ax2d(axis1P1,mirrorVector1));
323 BRepBuilderAPI_Transform transformer1(mirror1);
324 transformer1.Perform(originalWire);
325 if(!transformer1.IsDone()) {
326 di << "Not Done1 " << "\n";
327 return Standard_False;
329 const TopoDS_Shape& step1ModifiedShape = transformer1.ModifiedShape(originalWire);
331 BRepExtrema_DistShapeShape distShapeShape1(grossPlateFace,step1ModifiedShape,Extrema_ExtFlag_MIN);
332 if(!distShapeShape1.IsDone())
333 return Standard_False;
334 if(distShapeShape1.Value() > 0.01) {
335 di << "Dist = " <<distShapeShape1.Value() <<"\n";
336 return Standard_False;
338 di << "Dist1 = " <<distShapeShape1.Value() <<"\n";
340 //////////////////////////////////////////////////////////////////////////
342 transformer1.Perform(step1ModifiedShape);
343 if(!transformer1.IsDone()) {
344 di << "Not Done1 \n";
345 return Standard_False;
347 const TopoDS_Shape& step2ModifiedShape = transformer1.ModifiedShape(step1ModifiedShape);
349 //This is identity matrix for values but for type is gp_Rotation ?!
350 gp_Trsf2d mirror11 = mirror1;
351 mirror11.PreMultiply(mirror1);
353 BRepExtrema_DistShapeShape distShapeShape2(grossPlateFace,step2ModifiedShape);//,Extrema_ExtFlag_MIN);
354 if(!distShapeShape2.IsDone())
355 return Standard_False;
357 //This last test case give error (the value is 1008.8822038689706)
358 if(distShapeShape2.Value() > 0.01) {
359 di << "Wrong Dist2 = " <<distShapeShape2.Value() <<"\n";
360 Standard_Integer N = distShapeShape2.NbSolution();
361 di << "Nb = " <<N <<"\n";
362 for (Standard_Integer i=1;i <= N;i++)
363 di <<"Sol(" <<i<<") = " <<distShapeShape2.PointOnShape1(i).Distance(distShapeShape2.PointOnShape2(i)) <<"\n";
364 return Standard_False;
366 di << "Distance2 = " <<distShapeShape2.Value() <<"\n";
368 return Standard_True;
370 static Standard_Integer OCC23774(Draw_Interpretor& di, Standard_Integer n, const char** a)
374 di <<"OCC23774: invalid number of input parameters\n";
378 const char *ns1 = (a[1]), *ns2 = (a[2]);
379 TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
380 if (S1.IsNull() || S2.IsNull()) {
381 di <<"OCC23774: Null input shapes\n";
384 const TopoDS_Face& aFace = TopoDS::Face(S1);
385 if(!OCC23774Test(aFace, S2, di))
386 di << "Something is wrong\n";
391 #include <GeomConvert_ApproxSurface.hxx>
392 #include <Geom_BSplineSurface.hxx>
394 #include <OSD_Thread.hxx>
395 static void GeomConvertTest (Draw_Interpretor& di, Standard_Integer theTargetNbUPoles, Standard_CString theFileName)
397 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(theFileName);
398 GeomConvert_ApproxSurface aGAS (aSurf, 1e-4, GeomAbs_C1, GeomAbs_C1, 9, 9, 100, 1);
399 if (!aGAS.IsDone()) {
400 di << "ApproxSurface is not done!" << "\n";
403 const Handle(Geom_BSplineSurface)& aBSurf = aGAS.Surface();
404 if (aBSurf.IsNull()) {
405 di << "BSplineSurface is not created!" << "\n";
408 di << "Number of UPoles:" << aBSurf->NbUPoles() << "\n";
409 QCOMPARE (aBSurf->NbUPoles(), theTargetNbUPoles);
413 Draw_Interpretor* di;
414 Standard_Integer nbupoles;
415 Standard_CString filename;
418 Standard_EXPORT Standard_Address convert(Standard_Address data)
420 aData* info = (aData*) data;
421 GeomConvertTest(*(info->di),info->nbupoles,info->filename);
425 static Standard_Integer OCC23952sweep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
428 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
431 struct aData aStorage;
433 aStorage.nbupoles = Draw::Atoi(argv[1]);
434 aStorage.filename = argv[2];
436 OSD_Thread aThread1(convert);
437 aThread1.Run(&aStorage);
438 GeomConvertTest(di,aStorage.nbupoles,aStorage.filename);
439 cout << "result of thread: " << aThread1.Wait() << endl;
444 #include <GeomInt_IntSS.hxx>
445 static void GeomIntSSTest (Draw_Interpretor& di, Standard_Integer theNbSol, Standard_CString theFileName1, Standard_CString theFileName2)
447 Handle(Geom_Surface) aSurf1 = DrawTrSurf::GetSurface(theFileName1);
448 Handle(Geom_Surface) aSurf2 = DrawTrSurf::GetSurface(theFileName2);
449 GeomInt_IntSS anInter;
450 anInter.Perform(aSurf1, aSurf2, Precision::Confusion(), Standard_True);
451 if (!anInter.IsDone()) {
452 di << "An intersection is not done!" << "\n";
456 di << "Number of Lines:" << anInter.NbLines() << "\n";
457 QCOMPARE (anInter.NbLines(), theNbSol);
461 Draw_Interpretor* di;
462 Standard_Integer nbsol;
463 Standard_CString filename1;
464 Standard_CString filename2;
466 Standard_EXPORT Standard_Address convert_inter(Standard_Address data)
468 aNewData* info = (aNewData*) data;
469 GeomIntSSTest(*(info->di),info->nbsol,info->filename1,info->filename2);
473 static Standard_Integer OCC23952intersect (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
476 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
479 struct aNewData aStorage;
481 aStorage.nbsol = Draw::Atoi(argv[1]);
482 aStorage.filename1 = argv[2];
483 aStorage.filename2 = argv[3];
485 OSD_Thread aThread1(convert_inter);
486 aThread1.Run(&aStorage);
487 GeomIntSSTest(di,aStorage.nbsol,aStorage.filename1,aStorage.filename2);
488 cout << "result of thread: " << aThread1.Wait() << endl;
493 #include <Geom_SurfaceOfRevolution.hxx>
494 static Standard_Integer OCC23683 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
497 di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
501 Standard_Integer ucontinuity = 1;
502 Standard_Integer vcontinuity = 1;
503 Standard_Boolean iscnu = false;
504 Standard_Boolean iscnv = false;
506 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[1]);
508 QCOMPARE (aSurf->IsCNu (ucontinuity), iscnu);
509 QCOMPARE (aSurf->IsCNv (vcontinuity), iscnv);
514 #include <gp_Ax1.hxx>
515 #include <gp_Ax22d.hxx>
516 #include <Geom_Plane.hxx>
517 #include <Geom2d_Circle.hxx>
518 #include <Geom2d_TrimmedCurve.hxx>
519 #include <BRepBuilderAPI_MakeEdge.hxx>
520 #include <BRepPrimAPI_MakeRevol.hxx>
521 #include <Geom2d_OffsetCurve.hxx>
523 static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
525 // Check the command arguments
528 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
529 di << "Usage: type help " << argv[0] << "\n";
530 return 1; // TCL_ERROR
533 gp_Ax1 RotoAx( gp::Origin(), gp::DZ() );
534 gp_Ax22d Ax2( gp::Origin2d(), gp::DY2d(), gp::DX2d() );
535 Handle(Geom_Surface) Plane = new Geom_Plane( gp::YOZ() );
537 di << "<<<< Preparing sample surface of revolution based on trimmed curve >>>>" << "\n";
538 di << "-----------------------------------------------------------------------" << "\n";
540 Handle(Geom2d_Circle) C2d1 = new Geom2d_Circle(Ax2, 1.0);
541 Handle(Geom2d_TrimmedCurve) C2d1Trimmed = new Geom2d_TrimmedCurve(C2d1, 0.0, M_PI/2.0);
542 TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(C2d1Trimmed, Plane);
544 DBRep::Set("e1", E1);
546 BRepPrimAPI_MakeRevol aRevolBuilder1(E1, RotoAx);
547 TopoDS_Face F1 = TopoDS::Face( aRevolBuilder1.Shape() );
549 DBRep::Set("f1", F1);
551 di << "Result: f1" << "\n";
553 di << "<<<< Preparing sample surface of revolution based on offset curve >>>>" << "\n";
554 di << "-----------------------------------------------------------------------" << "\n";
556 Handle(Geom2d_OffsetCurve) C2d2Offset = new Geom2d_OffsetCurve(C2d1Trimmed, -0.5);
557 TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(C2d2Offset, Plane);
559 DBRep::Set("e2", E2);
561 BRepPrimAPI_MakeRevol aRevolBuilder2(E2, RotoAx);
562 TopoDS_Face F2 = TopoDS::Face( aRevolBuilder2.Shape() );
564 DBRep::Set("f2", F2);
566 di << "Result: f2" << "\n";
571 #include <GeomAdaptor_Surface.hxx>
573 //=======================================================================
574 //function : OCC23945
576 //=======================================================================
578 static Standard_Integer OCC23945 (Draw_Interpretor& /*di*/,Standard_Integer n, const char** a)
582 Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(a[1]);
583 if (aS.IsNull()) return 1;
585 GeomAdaptor_Surface GS(aS);
587 Standard_Real U = Draw::Atof(a[2]);
588 Standard_Real V = Draw::Atof(a[3]);
590 Standard_Boolean DrawPoint = ( n%3 == 2);
598 GS.D2(U,V,P,DU,DV,D2U,D2V,D2UV);
599 Draw::Set(a[13],D2U.X());
600 Draw::Set(a[14],D2U.Y());
601 Draw::Set(a[15],D2U.Z());
602 Draw::Set(a[16],D2V.X());
603 Draw::Set(a[17],D2V.Y());
604 Draw::Set(a[18],D2V.Z());
605 Draw::Set(a[19],D2UV.X());
606 Draw::Set(a[20],D2UV.Y());
607 Draw::Set(a[21],D2UV.Z());
612 Draw::Set(a[7],DU.X());
613 Draw::Set(a[8],DU.Y());
614 Draw::Set(a[9],DU.Z());
615 Draw::Set(a[10],DV.X());
616 Draw::Set(a[11],DV.Y());
617 Draw::Set(a[12],DV.Z());
623 Draw::Set(a[4],P.X());
624 Draw::Set(a[5],P.Y());
625 Draw::Set(a[6],P.Z());
628 DrawTrSurf::Set(a[n],P);
634 #include <Voxel_BoolDS.hxx>
635 #include <Voxel_FastConverter.hxx>
636 #include <Voxel_BooleanOperation.hxx>
637 static Standard_Integer OCC24019 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
640 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
644 TCollection_AsciiString aFileName = argv[1];
646 BRep_Builder aBuilder;
648 if (!BRepTools::Read(aShape, aFileName.ToCString(), aBuilder)) {
649 di << "Error: Could not read a shape!" << "\n";
653 TopoDS_Solid aShape1 = BRepPrimAPI_MakeSphere(gp_Pnt(20,25,35), 7);
655 Standard_Real deflection = 0.005;
656 Standard_Integer nbThreads = 1;
657 Standard_Integer nbx = 200, nby = 200, nbz = 200;
658 Voxel_BoolDS theVoxels(0,0,0, 50, 50, 50, nbx, nby, nbz);
659 Voxel_BoolDS theVoxels1(0,0,0, 50, 50, 50, nbx, nby, nbz);
661 Standard_Integer progress = 0;
662 Voxel_FastConverter fcp(aShape, theVoxels, deflection, nbx, nby, nbz, nbThreads);
663 fcp.ConvertUsingSAT(progress, 1);
666 Voxel_FastConverter fcp1(aShape1, theVoxels1, deflection, nbx, nby, nbz, nbThreads);
667 fcp1.ConvertUsingSAT(progress, 1);
668 fcp1.FillInVolume(1);
670 Voxel_BooleanOperation op;
671 Standard_Boolean result = op.Cut(theVoxels1, theVoxels);
673 di << "Error: invalid boolean operation" << "\n";
675 di << "OK: boolean operation is ok" << "\n";
681 //=======================================================================
682 //function : OCC11758
684 //=======================================================================
685 static Standard_Integer OCC11758 (Draw_Interpretor& di, Standard_Integer n, const char**)
687 if (n != 1) return 1;
689 const char* theStr = "0123456789";
690 Standard_Integer i, j;
691 for ( i = 0; i < 5; ++i ) {
692 // TCollection_AsciiString(const Standard_CString astring)
693 TCollection_AsciiString a(theStr+i);
694 // IsEqual (const Standard_CString other)const
695 //assert( a == theStr+i );
696 QCOMPARE ( a , theStr+i );
698 //TCollection_AsciiString(const Standard_CString astring,const Standard_Integer aLen )
699 TCollection_AsciiString b(theStr+i, 3);
700 //assert( b.Length() == 3 );
701 //assert( strncmp( b.ToCString(), theStr+i, 3 ) == 0 );
702 //assert( strlen( b.ToCString() ) == 3 );
703 QCOMPARE ( b.Length() , 3 );
704 QCOMPARE ( strncmp( b.ToCString() , theStr+i, 3 ) , 0 );
705 QCOMPARE ( b.Length() , 3 );
707 //TCollection_AsciiString(const Standard_Integer aValue)
708 TCollection_AsciiString c(i);
709 //assert( c.IsIntegerValue() );
710 //assert( c.IntegerValue() == i );
711 QCOMPARE ( c.IsIntegerValue() , Standard_True );
712 QCOMPARE ( c.IntegerValue() , i );
714 //TCollection_AsciiString(const Standard_Real aValue)
715 TCollection_AsciiString d( 0.1*i );
716 //assert( d.IsRealValue() );
717 //assert( TCollection_AsciiString(3.3) == "3.3");
718 QCOMPARE ( d.IsRealValue() , Standard_True );
719 QCOMPARE ( TCollection_AsciiString(3.3) , "3.3" );
721 //TCollection_AsciiString(const TCollection_AsciiString& astring)
722 TCollection_AsciiString e(d);
724 //assert( e.Length() == d.Length() );
725 //assert( strcmp( e.ToCString(), d.ToCString() ) == 0 );
727 QCOMPARE ( e.Length() , d.Length() );
728 QCOMPARE ( strcmp( e.ToCString(), d.ToCString() ) , 0 );
730 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
731 // const Standard_Character other )
732 TCollection_AsciiString f(e,'\a');
733 //assert( f.Length() == e.Length() + 1 );
734 //assert( strncmp( f.ToCString(), e.ToCString(), e.Length() ) == 0 );
735 //assert( f.Value( f.Length() ) == '\a');
736 QCOMPARE ( f.Length() , e.Length() + 1 );
737 QCOMPARE ( strncmp( f.ToCString(), e.ToCString(), e.Length() ) , 0 );
738 QCOMPARE ( f.Value( f.Length() ) , '\a' );
740 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
741 // const Standard_CString other )
742 TCollection_AsciiString g(f, theStr);
743 //assert( g.Length() == f.Length() + strlen( theStr ));
744 //assert( strncmp( g.ToCString(), f.ToCString(), f.Length() ) == 0 );
745 //assert( g.Search( theStr ) == f.Length() + 1 );
746 QCOMPARE ( g.Length() , f.Length() + (Standard_Integer)strlen( theStr ) );
747 QCOMPARE ( strncmp( g.ToCString(), f.ToCString(), f.Length() ) , 0 );
748 QCOMPARE ( g.Search( theStr ) , f.Length() + 1 );
750 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
751 // const TCollection_AsciiString& other )
752 TCollection_AsciiString h(d,a);
753 //assert( h.Length() == d.Length() + a.Length() );
754 //assert( strncmp( h.ToCString(), d.ToCString(), d.Length() ) == 0 );
755 //assert( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) == 0 );
756 QCOMPARE ( h.Length() , d.Length() + a.Length() );
757 QCOMPARE ( strncmp( h.ToCString(), d.ToCString(), d.Length() ) , 0 );
758 QCOMPARE ( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) , 0 );
760 // AssignCat(const Standard_CString other)
761 c.AssignCat( a.ToCString() );
762 //assert( c.Length() == 1 + a.Length() );
763 //assert( c.Search( a ) == 2 );
764 QCOMPARE ( c.Length() , 1 + a.Length() );
765 QCOMPARE ( c.Search( a ) , 2 );
767 // AssignCat(const TCollection_AsciiString& other)
768 Standard_Integer dl = d.Length();
770 //assert( d.Length() == dl + a.Length() );
771 //assert( d.Search( a ) == dl + 1 );
772 QCOMPARE ( d.Length() , dl + a.Length() );
773 QCOMPARE ( d.Search( a ) , dl + 1 );
776 TCollection_AsciiString capitalize("aBC");
777 capitalize.Capitalize();
778 //assert( capitalize == "Abc" );
779 QCOMPARE ( capitalize , "Abc" );
781 // Copy(const Standard_CString fromwhere)
783 //assert( d == theStr+i );
784 QCOMPARE ( d , theStr+i );
786 // Copy(const TCollection_AsciiString& fromwhere)
788 // IsEqual (const TCollection_AsciiString& other)const
792 // Insert(const Standard_Integer where, const Standard_CString what)
794 d.Insert( 2, theStr );
795 //assert( d.Length() == dl + strlen( theStr ));
796 //assert( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) == 0 );
797 QCOMPARE ( d.Length() , dl + (Standard_Integer)strlen( theStr ) );
798 QCOMPARE ( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) , 0 );
800 //Insert(const Standard_Integer where,const Standard_Character what)
802 d.Insert( i+1, 'i' );
803 //assert( d.Length() == strlen( theStr ) + 1 );
804 //assert( d.Value( i+1 ) == 'i');
805 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
806 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
807 QCOMPARE ( d.Value( i+1 ) , 'i' );
808 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
810 //Insert(const Standard_Integer where,const TCollection_AsciiString& what)
812 d.Insert( i+1, TCollection_AsciiString( "i" ));
813 //assert( d.Length() == strlen( theStr ) + 1 );
814 //assert( d.Value( i+1 ) == 'i');
815 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
816 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
817 QCOMPARE ( d.Value( i+1 ) , 'i' );
818 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
820 // IsDifferent (const Standard_CString other)const
821 //assert( d.IsDifferent( theStr ));
822 //assert( d.IsDifferent( "theStr" ));
823 //assert( d.IsDifferent( "" ));
824 //assert( !d.IsDifferent( d.ToCString() ));
825 QCOMPARE ( d.IsDifferent( theStr ) , Standard_True );
826 QCOMPARE ( d.IsDifferent( "theStr" ) , Standard_True );
827 QCOMPARE ( d.IsDifferent( "" ) , Standard_True );
828 QCOMPARE ( !d.IsDifferent( d.ToCString() ) , Standard_True );
830 // IsDifferent (const TCollection_AsciiString& other)const
831 //assert( d.IsDifferent( TCollection_AsciiString() ));
832 //assert( d.IsDifferent( a ));
833 //assert( d.IsDifferent( h ));
834 //assert( !d.IsDifferent( d ));
835 QCOMPARE ( d.IsDifferent( TCollection_AsciiString() ) , Standard_True );
836 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
837 QCOMPARE ( d.IsDifferent( h ) , Standard_True );
838 QCOMPARE ( !d.IsDifferent( d ) , Standard_True );
840 // IsLess (const Standard_CString other)const
841 //assert( TCollection_AsciiString ("0"). IsLess("1"));
842 //assert( TCollection_AsciiString ("0"). IsLess("00"));
843 //assert( TCollection_AsciiString (""). IsLess("0"));
844 //assert( !TCollection_AsciiString("1"). IsLess("0"));
845 //assert( !TCollection_AsciiString("00").IsLess("0"));
846 //assert( !TCollection_AsciiString("0"). IsLess(""));
847 //assert( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1));
848 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("1") , Standard_True );
849 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("00") , Standard_True );
850 QCOMPARE ( TCollection_AsciiString (""). IsLess("0") , Standard_True );
851 QCOMPARE ( !TCollection_AsciiString("1"). IsLess("0"), Standard_True );
852 QCOMPARE ( !TCollection_AsciiString("00").IsLess("0") , Standard_True );
853 QCOMPARE ( !TCollection_AsciiString("0"). IsLess("") , Standard_True );
854 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1) , Standard_True );
856 // IsLess (const TCollection_AsciiString& other)const
857 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )));
858 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")));
859 //assert( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )));
860 //assert( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )));
861 //assert( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )));
862 //assert( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )));
863 //assert( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)));
864 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )) , Standard_True );
865 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")) , Standard_True );
866 QCOMPARE ( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )) , Standard_True );
867 QCOMPARE ( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )) , Standard_True );
868 QCOMPARE ( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )) , Standard_True );
869 QCOMPARE ( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )) , Standard_True );
870 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)) , Standard_True );
872 // IsGreater (const Standard_CString other)const
873 //assert( !TCollection_AsciiString("0"). IsGreater("1"));
874 //assert( !TCollection_AsciiString("0"). IsGreater("00"));
875 //assert( !TCollection_AsciiString(""). IsGreater("0"));
876 //assert( TCollection_AsciiString ("1"). IsGreater("0"));
877 //assert( TCollection_AsciiString ("00").IsGreater("0"));
878 //assert( TCollection_AsciiString ("0"). IsGreater(""));
879 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i));
880 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("1") , Standard_True );
881 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("00") , Standard_True );
882 QCOMPARE ( !TCollection_AsciiString(""). IsGreater("0") , Standard_True );
883 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater("0") , Standard_True );
884 QCOMPARE ( TCollection_AsciiString ("00").IsGreater("0") , Standard_True );
885 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater("") , Standard_True );
886 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i) , Standard_True );
888 // IsGreater (const TCollection_AsciiString& other)const
889 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )));
890 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")));
891 //assert( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )));
892 //assert( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )));
893 //assert( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )));
894 //assert( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )));
895 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)));
896 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )) , Standard_True );
897 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")) , Standard_True );
898 QCOMPARE ( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
899 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
900 QCOMPARE ( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )) , Standard_True );
901 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )) , Standard_True );
902 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)) , Standard_True );
904 // void Read(Standard_IStream& astream)
905 std::istringstream is( theStr );
907 //assert( e == theStr );
908 QCOMPARE ( e , theStr );
910 // Standard_Integer SearchFromEnd (const Standard_CString what)const
911 //assert( e.SearchFromEnd( theStr + i ) == i + 1 );
912 QCOMPARE ( e.SearchFromEnd( theStr + i ) , i + 1 );
914 // SetValue(const Standard_Integer where, const Standard_CString what)
915 e.SetValue( i+1, "what");
916 //assert( e.Search( "what" ) == i+1 );
917 //assert( e.Length() == strlen( theStr ));
918 QCOMPARE ( e.Search( "what" ) , i+1 );
919 QCOMPARE ( e.Length() , (Standard_Integer)strlen( theStr ) );
921 // TCollection_AsciiString Split (const Standard_Integer where)
924 //assert( d.Length() + e.Length() == strlen( theStr ));
925 QCOMPARE ( d.Length() + e.Length() , (Standard_Integer)strlen( theStr ) );
927 // TCollection_AsciiString SubString (const Standard_Integer FromIndex,
928 // const Standard_Integer ToIndex) const
930 d = e.SubString( (unsigned int)i+1, (unsigned int)i+3 );
931 //assert( d.Length() == 3 );
932 //assert( d.Value(1) == theStr[ i ]);
933 QCOMPARE ( d.Length() , 3 );
934 QCOMPARE ( d.Value(1) , theStr[ i ] );
936 // TCollection_AsciiString Token (const Standard_CString separators,
937 // const Standard_Integer whichone) const
939 for ( j = 0; j < i; ++j ) {
940 e += TCollection_AsciiString( theStr[j] ) + " ";
941 //assert( e.Token(" ", j+1 ) == TCollection_AsciiString( theStr+j, 1 ));
942 QCOMPARE ( e.Token(" ", j+1 ) , TCollection_AsciiString( theStr+j, 1 ) );
945 for ( i = 0; i < 5; ++i )
947 // TCollection_ExtendedString (const Standard_CString astring,
948 // const Standard_Boolean isMultiByte)
949 const TCollection_ExtendedString a( theStr+i );
950 //assert( TCollection_AsciiString( a ) == theStr+i );
951 QCOMPARE ( TCollection_AsciiString( a ) , theStr+i );
953 //TCollection_ExtendedString (const Standard_ExtString astring)
954 const TCollection_ExtendedString b( a.ToExtString() );
958 // TCollection_ExtendedString (const Standard_Integer length,
959 // const Standard_ExtCharacter filler )
960 const TCollection_ExtendedString c( i, 1 );
961 //assert( c.Length() == i );
962 QCOMPARE ( c.Length() , i );
963 if ( c.Length() > 0 ) {
964 //assert( c.Value( i ) == 1 );
965 QCOMPARE ( c.Value( i ) , 1 );
968 // TCollection_ExtendedString (const Standard_Integer aValue)
969 TCollection_ExtendedString d( i );
970 const TCollection_AsciiString da( d );
971 //assert( da.IsIntegerValue() );
972 //assert( da.IntegerValue() == i );
973 QCOMPARE ( da.IsIntegerValue() , Standard_True );
974 QCOMPARE ( da.IntegerValue(), i );
976 // TCollection_ExtendedString (const Standard_Real aValue)
977 const TCollection_ExtendedString e( 0.1 * i );
978 const TCollection_AsciiString ea( e );
979 //assert( ea.IsRealValue() );
980 //assert( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 );
981 QCOMPARE ( ea.IsRealValue() , Standard_True );
982 QCOMPARE ( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 , Standard_True );
984 // TCollection_ExtendedString (const TCollection_ExtendedString& astring)
985 const TCollection_ExtendedString f(e);
986 //assert( f.Length() == e.Length());
988 QCOMPARE ( f.Length() , e.Length() );
991 // TCollection_ExtendedString (const TCollection_AsciiString& astring)
992 const TCollection_ExtendedString g( ea );
993 //assert( g.Length() == ea.Length() );
994 //assert( TCollection_AsciiString( g ) == ea );
995 QCOMPARE ( g.Length() , ea.Length() );
996 QCOMPARE ( TCollection_AsciiString( g ) , ea );
998 // AssignCat (const TCollection_ExtendedString& other)
999 const TCollection_ExtendedString sep(",");
1002 //assert( d.Length() == 2 + g.Length() );
1003 //assert( d.Token( sep.ToExtString(), 1 ) == TCollection_ExtendedString( i ));
1004 //assert( d.Token( sep.ToExtString(), 2 ) == g );
1005 QCOMPARE ( d.Length() , 2 + g.Length() );
1006 QCOMPARE ( d.Token( sep.ToExtString(), 1 ) , TCollection_ExtendedString( i ) );
1007 QCOMPARE ( d.Token( sep.ToExtString(), 2 ) , g );
1009 // TCollection_ExtendedString Cat (const TCollection_ExtendedString& other) const
1010 const TCollection_ExtendedString cat = a.Cat( sep );
1011 //assert( cat.Length() == a.Length() + sep.Length() );
1012 //assert( cat.Search( a ) == 1 );
1013 //assert( cat.Search( sep ) == a.Length() + 1 );
1014 QCOMPARE ( cat.Length() , a.Length() + sep.Length() );
1015 QCOMPARE ( cat.Search( a ) , 1 );
1016 QCOMPARE ( cat.Search( sep ) , a.Length() + 1 );
1018 // Copy (const TCollection_ExtendedString& fromwhere)
1020 //assert( d.Length() == cat.Length() );
1021 //assert( d == cat );
1022 QCOMPARE ( d.Length() , cat.Length() );
1023 QCOMPARE ( d , cat );
1025 // IsEqual (const Standard_ExtString other) const
1026 //assert( d.IsEqual( d.ToExtString() ));
1027 QCOMPARE ( d.IsEqual( d.ToExtString() ) , Standard_True );
1029 // IsDifferent (const Standard_ExtString other ) const
1030 //assert( d.IsDifferent( a.ToExtString() ));
1031 QCOMPARE ( d.IsDifferent( a.ToExtString() ) , Standard_True );
1033 // IsDifferent (const TCollection_ExtendedString& other) const
1034 //assert( d.IsDifferent( a ));
1035 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
1037 // IsLess (const Standard_ExtString other) const
1038 const TCollection_ExtendedString l0("0"), l1("1"), l00("00"), l, ls(theStr+i), ls1(theStr+i+1);
1039 //assert( l0. IsLess( l1.ToExtString() ));
1040 //assert( l0. IsLess( l00.ToExtString() ));
1041 //assert( l. IsLess( l0.ToExtString() ));
1042 //assert( ! l1. IsLess( l0.ToExtString() ));
1043 //assert( ! l00.IsLess( l0.ToExtString() ));
1044 //assert( ! l0. IsLess( l.ToExtString() ));
1045 //assert( ls.IsLess( ls1.ToExtString() ));
1046 QCOMPARE ( l0. IsLess( l1.ToExtString() ) , Standard_True );
1047 QCOMPARE ( l0. IsLess( l00.ToExtString() ) , Standard_True );
1048 QCOMPARE ( l. IsLess( l0.ToExtString() ) , Standard_True );
1049 QCOMPARE ( ! l1. IsLess( l0.ToExtString() ) , Standard_True );
1050 QCOMPARE ( ! l00.IsLess( l0.ToExtString() ) , Standard_True );
1051 QCOMPARE ( ! l0. IsLess( l.ToExtString() ) , Standard_True );
1052 QCOMPARE ( ls.IsLess( ls1.ToExtString() ) , Standard_True );
1054 // IsLess (const TCollection_ExtendedString& other) const
1055 //assert( l0. IsLess( l1 ));
1056 //assert( l0. IsLess( l00 ));
1057 //assert( l. IsLess( l0 ));
1058 //assert( ! l1. IsLess( l0 ));
1059 //assert( ! l00.IsLess( l0 ));
1060 //assert( ! l0. IsLess( l ));
1061 //assert( ls.IsLess( ls1 ));
1062 QCOMPARE ( l0. IsLess( l1 ) , Standard_True );
1063 QCOMPARE ( l0. IsLess( l00 ) , Standard_True );
1064 QCOMPARE ( l. IsLess( l0 ) , Standard_True );
1065 QCOMPARE ( ! l1. IsLess( l0 ) , Standard_True );
1066 QCOMPARE ( ! l00.IsLess( l0 ) , Standard_True );
1067 QCOMPARE ( ! l0. IsLess( l ) , Standard_True );
1068 QCOMPARE ( ls.IsLess( ls1 ) , Standard_True );
1070 // IsGreater (const Standard_ExtString other) const
1071 //assert( ! l0.IsGreater( l1.ToExtString() ));
1072 //assert( ! l0.IsGreater( l00.ToExtString() ));
1073 //assert( ! l. IsGreater( l0.ToExtString() ));
1074 //assert( l1. IsGreater( l0.ToExtString() ));
1075 //assert( l00.IsGreater( l0.ToExtString() ));
1076 //assert( l0. IsGreater( l.ToExtString() ));
1077 //assert( ls1.IsGreater( ls.ToExtString() ));
1078 QCOMPARE ( ! l0.IsGreater( l1.ToExtString() ) , Standard_True );
1079 QCOMPARE ( ! l0.IsGreater( l00.ToExtString() ) , Standard_True );
1080 QCOMPARE ( ! l. IsGreater( l0.ToExtString() ) , Standard_True );
1081 QCOMPARE ( l1. IsGreater( l0.ToExtString() ) , Standard_True );
1082 QCOMPARE ( l00.IsGreater( l0.ToExtString() ) , Standard_True );
1083 QCOMPARE ( l0. IsGreater( l.ToExtString() ) , Standard_True );
1084 QCOMPARE ( ls1.IsGreater( ls.ToExtString() ) ,Standard_True );
1086 // IsGreater (const TCollection_ExtendedString& other) const
1087 //assert( ! l0.IsGreater( l1));
1088 //assert( ! l0.IsGreater( l00));
1089 //assert( ! l. IsGreater( l0));
1090 //assert( l1. IsGreater( l0));
1091 //assert( l00.IsGreater( l0));
1092 //assert( l0. IsGreater( l));
1093 //assert( ls1.IsGreater( ls));
1094 QCOMPARE ( ! l0.IsGreater( l1) , Standard_True );
1095 QCOMPARE ( ! l0.IsGreater( l00) , Standard_True );
1096 QCOMPARE ( ! l. IsGreater( l0) , Standard_True );
1097 QCOMPARE ( l1. IsGreater( l0) , Standard_True );
1098 QCOMPARE ( l00.IsGreater( l0) , Standard_True );
1099 QCOMPARE ( l0. IsGreater( l) , Standard_True );
1100 QCOMPARE ( ls1.IsGreater( ls) , Standard_True );
1102 // ==========================
1103 //TCollection_HAsciiString::
1104 // ==========================
1106 // IsDifferent(const Handle(TCollection_HAsciiString)& S)
1107 Handle(TCollection_HAsciiString) ha1 = new TCollection_HAsciiString( theStr+i );
1108 Handle(TCollection_HAsciiString) ha2 = new TCollection_HAsciiString( theStr+i+1 );
1109 //assert( ha1->IsDifferent( ha2 ));
1110 //assert( !ha1->IsDifferent( ha1 ));
1111 QCOMPARE ( ha1->IsDifferent( ha2 ) , Standard_True );
1112 QCOMPARE ( !ha1->IsDifferent( ha1 ) , Standard_True );
1114 // IsSameString (const Handle(TCollection_HAsciiString)& S)
1115 //assert( !ha1->IsSameString( ha2 ));
1116 //assert( ha1->IsSameString( ha1 ));
1117 QCOMPARE ( !ha1->IsSameString( ha2 ) , Standard_True );
1118 QCOMPARE ( ha1->IsSameString( ha1 ) , Standard_True );
1120 // IsSameState (const Handle(TCollection_HAsciiString)& other) const
1121 //assert( !ha1->IsSameState( ha2 ));
1122 //assert( ha1->IsSameState( ha1 ));
1123 QCOMPARE ( !ha1->IsSameState( ha2 ) , Standard_True );
1124 QCOMPARE ( ha1->IsSameState( ha1 ) , Standard_True );
1126 // IsSameString (const Handle(TCollection_HAsciiString)& S ,
1127 // const Standard_Boolean CaseSensitive) const
1128 //assert( !ha1->IsSameString( ha2, true ));
1129 //assert( ha1->IsSameString( ha1, true ));
1130 //assert( !ha1->IsSameString( ha2, false ));
1131 //assert( ha1->IsSameString( ha1, false ));
1132 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1133 QCOMPARE ( ha1->IsSameString( ha1, Standard_True ) , Standard_True );
1134 QCOMPARE ( !ha1->IsSameString( ha2, Standard_False ) , Standard_True );
1135 QCOMPARE ( ha1->IsSameString( ha1, Standard_False ) , Standard_True );
1137 ha1->SetValue( 1, "AbC0000000");
1138 ha2->SetValue( 1, "aBc0000000");
1139 //assert( !ha1->IsSameString( ha2, true ));
1140 //assert( ha1->IsSameString( ha2, false ));
1141 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1142 QCOMPARE ( ha1->IsSameString( ha2, Standard_False ), Standard_True );
1147 #include <Geom_CylindricalSurface.hxx>
1148 #include <IntTools_FaceFace.hxx>
1149 #include <IntTools_Curve.hxx>
1150 #include <IntTools_PntOn2Faces.hxx>
1152 static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
1156 theDI << "Wrong a number of arguments!\n";
1160 Handle_Geom_Plane plane(new Geom_Plane(
1161 gp_Ax3( gp_Pnt(-72.948737453424499, 754.30437716359393, 259.52151854671678),
1162 gp_Dir(6.2471473085930200e-007, -0.99999999999980493, 0.00000000000000000),
1163 gp_Dir(0.99999999999980493, 6.2471473085930200e-007, 0.00000000000000000))));
1164 Handle(Geom_CylindricalSurface) cylinder(
1165 new Geom_CylindricalSurface(
1166 gp_Ax3(gp_Pnt(-6.4812490053250649, 753.39408794522092, 279.16400974257465),
1167 gp_Dir(1.0000000000000000, 0.0, 0.00000000000000000),
1168 gp_Dir(0.0, 1.0000000000000000, 0.00000000000000000)),
1169 19.712534607908712));
1171 DrawTrSurf::Set("pln", plane);
1173 DrawTrSurf::Set("cyl", cylinder);
1176 BRep_Builder builder;
1177 TopoDS_Face face1, face2;
1178 builder.MakeFace(face1, plane, Precision::Confusion());
1179 builder.MakeFace(face2, cylinder, Precision::Confusion());
1180 IntTools_FaceFace anInters;
1181 anInters.SetParameters(false, true, true, Precision::Confusion());
1182 anInters.Perform(face1, face2);
1184 if (!anInters.IsDone())
1186 theDI<<"No intersections found!"<<"\n";
1191 //Handle(Geom_Curve) aResult;
1194 const IntTools_SequenceOfCurves& aCvsX=anInters.Lines();
1195 const IntTools_SequenceOfPntOn2Faces& aPntsX=anInters.Points();
1198 Standard_Integer aNbCurves, aNbPoints;
1200 aNbCurves=aCvsX.Length();
1201 aNbPoints=aPntsX.Length();
1205 for (Standard_Integer i=1; i<=aNbCurves; ++i)
1207 Sprintf(buf, "%s_%d",theArgv[1],i);
1208 theDI << buf << " ";
1210 const IntTools_Curve& aIC = aCvsX(i);
1211 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1212 DrawTrSurf::Set(buf,aC3D);
1215 else if (aNbCurves == 1)
1217 const IntTools_Curve& aIC = aCvsX(1);
1218 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1219 Sprintf(buf, "%s",theArgv[1]);
1220 theDI << buf << " ";
1221 DrawTrSurf::Set(buf,aC3D);
1224 for (Standard_Integer i = 1; i<=aNbPoints; ++i)
1226 const IntTools_PntOn2Faces& aPi=aPntsX(i);
1227 const gp_Pnt& aP=aPi.P1().Pnt();
1229 Sprintf(buf,"%s_p_%d",theArgv[1],i);
1230 theDI << buf << " ";
1231 DrawTrSurf::Set(buf, aP);
1237 #include <Extrema_FuncExtPS.hxx>
1238 #include <math_FunctionSetRoot.hxx>
1239 #include <math_Vector.hxx>
1240 #include <BRepBuilderAPI_MakeVertex.hxx>
1241 static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
1243 Standard_Integer anArgIter = 1;
1246 theDI <<"Usage: " << theArgv[0] << " face vertex U V [N]"<<"\n";
1251 Standard_CString aFaceName = theArgv[anArgIter++];
1252 Standard_CString aVertName = theArgv[anArgIter++];
1253 const TopoDS_Shape aShapeF = DBRep::Get (aFaceName);
1254 const TopoDS_Shape aShapeV = DBRep::Get (aVertName);
1255 const Standard_Real aUFrom = Atof (theArgv[anArgIter++]);
1256 const Standard_Real aVFrom = Atof (theArgv[anArgIter++]);
1257 const Standard_Integer aNbIts = (anArgIter < theNArg) ? atol (theArgv[anArgIter++]) : 100;
1258 if (aShapeF.IsNull() || aShapeF.ShapeType() != TopAbs_FACE)
1260 std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl;
1263 if (aShapeV.IsNull() || aShapeV.ShapeType() != TopAbs_VERTEX)
1265 std::cout << "Error: " << aVertName << " shape is null / not a vertex" << std::endl;
1268 const TopoDS_Face aFace = TopoDS::Face (aShapeF);
1269 const TopoDS_Vertex aVert = TopoDS::Vertex (aShapeV);
1270 GeomAdaptor_Surface aSurf (BRep_Tool::Surface (aFace));
1272 gp_Pnt aPnt = BRep_Tool::Pnt (aVert), aRes;
1274 Extrema_FuncExtPS anExtFunc;
1275 math_FunctionSetRoot aRoot (anExtFunc, aNbIts);
1277 math_Vector aTolUV (1, 2), aUVinf (1, 2), aUVsup (1, 2), aFromUV (1, 2);
1278 aTolUV (1) = Precision::Confusion(); aTolUV (2) = Precision::Confusion();
1279 aUVinf (1) = -Precision::Infinite(); aUVinf (2) = -Precision::Infinite();
1280 aUVsup (1) = Precision::Infinite(); aUVsup (2) = Precision::Infinite();
1281 aFromUV(1) = aUFrom; aFromUV(2) = aVFrom;
1283 anExtFunc.Initialize (aSurf);
1284 anExtFunc.SetPoint (aPnt);
1285 aRoot.SetTolerance (aTolUV);
1286 aRoot.Perform (anExtFunc, aFromUV, aUVinf, aUVsup);
1287 if (!aRoot.IsDone())
1289 std::cerr << "No results!\n";
1293 theDI << aRoot.Root()(1) << " " << aRoot.Root()(2) << "\n";
1295 aSurf.D0 (aRoot.Root()(1), aRoot.Root()(2), aRes);
1296 DBRep::Set ("result", BRepBuilderAPI_MakeVertex (aRes));
1300 void QABugs::Commands_19(Draw_Interpretor& theCommands) {
1301 const char *group = "QABugs";
1303 theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
1304 theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
1305 theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
1306 theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group);
1307 theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
1308 theCommands.Add ("OCC23595", "OCC23595", __FILE__, OCC23595, group);
1309 theCommands.Add ("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group);
1310 theCommands.Add ("OCC22595", "OCC22595", __FILE__, OCC22595, group);
1311 theCommands.Add ("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group);
1312 theCommands.Add ("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group);
1313 theCommands.Add ("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group);
1314 theCommands.Add ("OCC23952intersect", "OCC23952intersect nbsol shape1 shape2", __FILE__, OCC23952intersect, group);
1315 theCommands.Add ("test_offset", "test_offset", __FILE__, test_offset, group);
1316 theCommands.Add("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group);
1317 theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
1318 theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
1319 theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
1320 theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);