From: Pasukhin Dmitry Date: Mon, 10 Nov 2025 21:17:50 +0000 (+0000) Subject: Testing - Migrate QA DRAW tests to GTest (#818) X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d166ff70e71987ba1e5e50ec42e0ce36ae01ccf2;p=occt.git Testing - Migrate QA DRAW tests to GTest (#818) - Removed 37 DRAW test scripts from `tests/bugs/` directories - Added 31 new GTest C++ test files in appropriate `GTests/` directories - Removed corresponding QAcommands implementations from QABugs source files - Updated CMake FILES.cmake files to include new test files --- diff --git a/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake b/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake index 10e22a4119..1e8e815943 100644 --- a/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake +++ b/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake @@ -2,4 +2,8 @@ set(OCCT_TKLCAF_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKLCAF_GTests_FILES + TDataStd_Attribute_Test.cxx + TDataStd_TreeNode_Test.cxx + TNaming_Builder_Test.cxx + TNaming_Name_Test.cxx ) diff --git a/src/ApplicationFramework/TKLCAF/GTests/TDataStd_Attribute_Test.cxx b/src/ApplicationFramework/TKLCAF/GTests/TDataStd_Attribute_Test.cxx new file mode 100644 index 0000000000..1509a2ccef --- /dev/null +++ b/src/ApplicationFramework/TKLCAF/GTests/TDataStd_Attribute_Test.cxx @@ -0,0 +1,109 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +TEST(TDataStd_Attribute_Test, OCC29371_AttributeGUIDsNotNull) +{ + // Create document and label + Handle(TDocStd_Application) anApp = new TDocStd_Application(); + Handle(TDocStd_Document) aDoc; + anApp->NewDocument("BinOcaf", aDoc); + TDF_Label aLab = aDoc->Main(); + + // Null GUID for comparison + Standard_GUID aNullGuid("00000000-0000-0000-0000-000000000000"); + + // Test each TDataStd attribute type has non-null GUID + Handle(TDataStd_AsciiString) aStrAtt = new TDataStd_AsciiString(); + aLab.AddAttribute(aStrAtt); + EXPECT_NE(aNullGuid, aStrAtt->ID()); + + Handle(TDataStd_BooleanArray) aBArAtt = new TDataStd_BooleanArray(); + aLab.AddAttribute(aBArAtt); + EXPECT_NE(aNullGuid, aBArAtt->ID()); + + Handle(TDataStd_BooleanList) aBListAtt = new TDataStd_BooleanList(); + aLab.AddAttribute(aBListAtt); + EXPECT_NE(aNullGuid, aBListAtt->ID()); + + Handle(TDataStd_ByteArray) aByteArAtt = new TDataStd_ByteArray(); + aLab.AddAttribute(aByteArAtt); + EXPECT_NE(aNullGuid, aByteArAtt->ID()); + + Handle(TDataStd_ExtStringArray) anExtStrArAtt = new TDataStd_ExtStringArray(); + aLab.AddAttribute(anExtStrArAtt); + EXPECT_NE(aNullGuid, anExtStrArAtt->ID()); + + Handle(TDataStd_ExtStringList) anExtStrListAtt = new TDataStd_ExtStringList(); + aLab.AddAttribute(anExtStrListAtt); + EXPECT_NE(aNullGuid, anExtStrListAtt->ID()); + + Handle(TDataStd_Integer) anIntAtt = new TDataStd_Integer(); + aLab.AddAttribute(anIntAtt); + EXPECT_NE(aNullGuid, anIntAtt->ID()); + + Handle(TDataStd_IntegerArray) anIntArrAtt = new TDataStd_IntegerArray(); + aLab.AddAttribute(anIntArrAtt); + EXPECT_NE(aNullGuid, anIntArrAtt->ID()); + + Handle(TDataStd_IntegerList) anIntListAtt = new TDataStd_IntegerList(); + aLab.AddAttribute(anIntListAtt); + EXPECT_NE(aNullGuid, anIntListAtt->ID()); + + Handle(TDataStd_Name) aNameAtt = new TDataStd_Name(); + aLab.AddAttribute(aNameAtt); + EXPECT_NE(aNullGuid, aNameAtt->ID()); + + Handle(TDataStd_Real) aRealAtt = new TDataStd_Real(); + aLab.AddAttribute(aRealAtt); + EXPECT_NE(aNullGuid, aRealAtt->ID()); + + Handle(TDataStd_RealArray) aRealArrAtt = new TDataStd_RealArray(); + aLab.AddAttribute(aRealArrAtt); + EXPECT_NE(aNullGuid, aRealArrAtt->ID()); + + Handle(TDataStd_RealList) aRealListAtt = new TDataStd_RealList(); + aLab.AddAttribute(aRealListAtt); + EXPECT_NE(aNullGuid, aRealListAtt->ID()); + + Handle(TDataStd_ReferenceArray) aRefArrAtt = new TDataStd_ReferenceArray(); + aLab.AddAttribute(aRefArrAtt); + EXPECT_NE(aNullGuid, aRefArrAtt->ID()); + + Handle(TDataStd_ReferenceList) aRefListAtt = new TDataStd_ReferenceList(); + aLab.AddAttribute(aRefListAtt); + EXPECT_NE(aNullGuid, aRefListAtt->ID()); + + anApp->Close(aDoc); +} diff --git a/src/ApplicationFramework/TKLCAF/GTests/TDataStd_TreeNode_Test.cxx b/src/ApplicationFramework/TKLCAF/GTests/TDataStd_TreeNode_Test.cxx new file mode 100644 index 0000000000..424fb80dd3 --- /dev/null +++ b/src/ApplicationFramework/TKLCAF/GTests/TDataStd_TreeNode_Test.cxx @@ -0,0 +1,42 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include + +// Test BUC60817: TDataStd_TreeNode descendant relationship +TEST(TDataStd_TreeNode_Test, BUC60817_DescendantRelationship) +{ + // Create TDF document + Handle(TDF_Data) aDF = new TDF_Data(); + + // Create two labels + TDF_Label aLabel1 = aDF->Root().FindChild(2, Standard_True); + TDF_Label aLabel2 = aDF->Root().FindChild(3, Standard_True); + + // Create TreeNodes on the labels + Handle(TDataStd_TreeNode) aTN1 = TDataStd_TreeNode::Set(aLabel1); + Handle(TDataStd_TreeNode) aTN2 = TDataStd_TreeNode::Set(aLabel2); + + // Append TN2 as a child of TN1 + aTN1->Append(aTN2); + + // Verify that TN2 is a descendant of TN1 + EXPECT_TRUE(aTN2->IsDescendant(aTN1)) << "TN2 should be a descendant of TN1 after Append"; + + // Verify that TN1 is NOT a descendant of TN2 + EXPECT_FALSE(aTN1->IsDescendant(aTN2)) << "TN1 should not be a descendant of TN2"; +} diff --git a/src/ApplicationFramework/TKLCAF/GTests/TNaming_Builder_Test.cxx b/src/ApplicationFramework/TKLCAF/GTests/TNaming_Builder_Test.cxx new file mode 100644 index 0000000000..a068a95570 --- /dev/null +++ b/src/ApplicationFramework/TKLCAF/GTests/TNaming_Builder_Test.cxx @@ -0,0 +1,57 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include + +// Test OCC361bug: TNaming_Builder preservation of shape orientation +TEST(TNaming_Builder_Test, OCC361_ShapeOrientationPreservation) +{ + // Create a document + Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinOcaf"); + + // Create a box shape + BRepPrimAPI_MakeBox aBoxMaker(gp_Pnt(0, 0, 0), 100, 100, 100); + TopoDS_Shape aBox = aBoxMaker.Shape(); + aBox.Orientation(TopAbs_FORWARD); + + // Get the main label + TDF_Label aTestLabel = aDoc->Main(); + + // Create a TNaming_Builder and add the shape + TNaming_Builder aBuilder(aTestLabel); + aBuilder.Generated(aBox); + + // Create a copy with REVERSED orientation + TopoDS_Shape aBox1 = aBox; + aBox1.Orientation(TopAbs_REVERSED); + + // Clear all attributes from the label + aTestLabel.ForgetAllAttributes(); + + // Create a new builder with the reversed shape + TNaming_Builder aBuilder2(aTestLabel); + aBuilder2.Generated(aBox1); + + // Get the shape from the builder and verify orientation + aBox = aBuilder2.NamedShape()->Get(); + + EXPECT_EQ(TopAbs_REVERSED, aBox.Orientation()) + << "Shape orientation should be preserved as REVERSED after TNaming_Builder operations"; +} diff --git a/src/ApplicationFramework/TKLCAF/GTests/TNaming_Name_Test.cxx b/src/ApplicationFramework/TKLCAF/GTests/TNaming_Name_Test.cxx new file mode 100644 index 0000000000..9bb0ef999c --- /dev/null +++ b/src/ApplicationFramework/TKLCAF/GTests/TNaming_Name_Test.cxx @@ -0,0 +1,47 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include + +// Test BUC60925: TNaming_Name solve with empty NamedShape +TEST(TNaming_Name_Test, BUC60925_SolveWithEmptyNamedShape) +{ + // Create TDF document + Handle(TDF_Data) aDF = new TDF_Data(); + + // Create a label + TDF_Label aLabel = aDF->Root().FindChild(2, Standard_True); + + // Create label map + TDF_LabelMap aLabelMap; + aLabelMap.Add(aLabel); + + // Create an empty NamedShape + Handle(TNaming_NamedShape) aNS = new TNaming_NamedShape; + + // Create TNaming_Name and configure it + TNaming_Name aNN; + aNN.Type(TNaming_IDENTITY); + aNN.Append(aNS); + + // Test that Solve returns false for empty NamedShape + Standard_Boolean aResult = aNN.Solve(aLabel, aLabelMap); + + EXPECT_FALSE(aResult) << "Solve should return false for empty NamedShape"; +} diff --git a/src/Draw/TKQADraw/QABugs/QABugs_1.cxx b/src/Draw/TKQADraw/QABugs/QABugs_1.cxx index 4b07ccde82..5e8256211b 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_1.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_1.cxx @@ -374,50 +374,6 @@ static Standard_Integer OCC74bug_get(Draw_Interpretor& di, Standard_Integer argc #include #include -static Standard_Integer OCC361bug(Draw_Interpretor& di, Standard_Integer nb, const char** a) -{ - if (nb != 2) - { - di << "ERROR : Usage : " << a[0] << " Doc\n"; - di << "-1\n"; - return -1; - } - - Handle(TDocStd_Document) D; - if (!DDocStd::GetDocument(a[1], D)) - { - di << "-2\n"; - return 1; - } - - BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100); - TopoDS_Shape aTBox = aBox.Shape(); - aTBox.Orientation(TopAbs_FORWARD); - - TDF_Label aTestLabel = D->Main(); - - TNaming_Builder aBuilder(aTestLabel); - aBuilder.Generated(aTBox); - - TopoDS_Shape aTBox1 = aTBox; - aTBox1.Orientation(TopAbs_REVERSED); - aTestLabel.ForgetAllAttributes(); - - TNaming_Builder aBuilder2(aTestLabel); - aBuilder2.Generated(aTBox1); - - aTBox = aBuilder2.NamedShape()->Get(); - if (aTBox.Orientation() != TopAbs_REVERSED) - { - di << "1\n"; - } - else - { - di << "0\n"; - } - return 0; -} - #include #include #include @@ -684,7 +640,6 @@ void QABugs::Commands_1(Draw_Interpretor& theCommands) OCC74bug_get, group); - theCommands.Add("OCC361", "OCC361 Doc ", __FILE__, OCC361bug, group); theCommands.Add("OCC30182", "OCC30182 name image [-offset Start] [-fileName] [-stream] [-memory]\n" "Decodes image either by passing file name, file stream or memory stream", diff --git a/src/Draw/TKQADraw/QABugs/QABugs_11.cxx b/src/Draw/TKQADraw/QABugs/QABugs_11.cxx index a99f686e4e..66507011a0 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_11.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_11.cxx @@ -80,6 +80,8 @@ #include #include #include +#include +#include #include #include #include @@ -841,66 +843,6 @@ Standard_Integer OCC299bug(Draw_Interpretor& theDi, } #include -#include - -static Standard_Integer OCC309bug(Draw_Interpretor& di, Standard_Integer nb, const char** a) -{ - if (nb != 1) - { - di << "Usage: " << a[0] << "\n"; - return 1; - } - OSD_Process p; - OSD_Path d = p.CurrentDirectory(); - TCollection_AsciiString s; - d.SystemName(s); - di << "*" << s.ToCString() << "*\n"; - d.UpTrek(); - d.SystemName(s); - di << "*" << s.ToCString() << "*\n"; - return 0; -} - -static Standard_Integer OCC310bug(Draw_Interpretor& di, Standard_Integer nb, const char** a) -{ - if (nb != 1) - { - di << "Usage: " << a[0] << "\n"; - return 1; - } - OSD_Path p("/where/you/want/tmp/qwerty/tmp/"); - di << p.Trek().ToCString() << "\n"; - p.UpTrek(); - di << p.Trek().ToCString() << "\n"; - return 0; -} - -#include -#include - -static Standard_Integer OCC277bug(Draw_Interpretor& di, Standard_Integer nb, const char** a) -{ - if (nb != 1) - { - di << "Usage : " << a[0] << "\n"; - return 1; - } - - BRepPrimAPI_MakeBox box1(100, 100, 100); - BRepPrimAPI_MakeBox box2(gp_Pnt(50, 50, 50), 200, 200, 200); - - TopoDS_Shape shape1 = box1.Shape(); - TopoDS_Shape shape2 = box2.Shape(); - - TopoDS_Shape fuse, comm; - di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )\n"; - di << "comm = BRepAlgoAPI_Common( shape1, shape2 )\n"; - fuse = BRepAlgoAPI_Fuse(shape1, shape2).Shape(); - comm = BRepAlgoAPI_Common(shape1, shape2).Shape(); - - return 0; -} - #include #include #include @@ -1370,25 +1312,6 @@ static Standard_Integer OCC524(Draw_Interpretor& di, Standard_Integer argc, cons //================================================================================================= -static Standard_Integer OCC525(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - GeomPlate_BuildPlateSurface aBuilder; - aBuilder.Perform(); - - if (aBuilder.IsDone()) - { - di << "Error in OCC525. Null result is expected.\n"; - } - else - { - di << "OCC525 OK \n"; - } - - return 0; -} - #include #include #include @@ -5236,11 +5159,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group); theCommands.Add("OCC299", "OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group); - theCommands.Add("OCC309", "OCC309", __FILE__, OCC309bug, group); - theCommands.Add("OCC310", "OCC310", __FILE__, OCC310bug, group); - - // theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group); - theCommands.Add("OCC277", "OCC277", __FILE__, OCC277bug, group); theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group); // Must use OCC299 @@ -5263,7 +5181,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) __FILE__, OCC524, group); - theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group); // theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group); theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group); theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group); diff --git a/src/Draw/TKQADraw/QABugs/QABugs_14.cxx b/src/Draw/TKQADraw/QABugs/QABugs_14.cxx index 9b7f99d8aa..5cc074c5fb 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_14.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_14.cxx @@ -384,67 +384,6 @@ static Standard_Integer BUC60870(Draw_Interpretor& di, Standard_Integer argc, co return 0; } -static Standard_Integer BUC60902(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 5); - gp_Pnt aP(0., 0., 0.); - for (Standard_Integer i = 1; i <= 5; i++) - { - aP.SetX((i - 1) * 1.57); - aP.SetY(Sin((i - 1) * 1.57)); - aPnts->SetValue(i, aP); - } - GeomAPI_Interpolate anInterpolater(aPnts, Standard_False, Precision::Confusion()); - anInterpolater.Perform(); - if (!anInterpolater.IsDone()) - { - di << "Faulty : error in interpolation\n"; - return 1; - } - Handle(Geom_BSplineCurve) aCur = anInterpolater.Curve(); - gp_Vec aFirstTang, aLastTang; - aCur->D1(aCur->FirstParameter(), aP, aFirstTang); - aCur->D1(aCur->LastParameter(), aP, aLastTang); - di << " Used Tang1 = " << aFirstTang.X() << " " << aFirstTang.Y() << " " << aFirstTang.Z() - << "\n"; - di << " Used Tang2 = " << aLastTang.X() << " " << aLastTang.Y() << " " << aLastTang.Z() << "\n"; - GeomAPI_Interpolate anInterpolater1(aPnts, Standard_False, Precision::Confusion()); - anInterpolater1.Load(aFirstTang, aLastTang, Standard_False); - anInterpolater1.Perform(); - if (!anInterpolater1.IsDone()) - { - di << "Faulty : error in interpolation 1\n"; - return 1; - } - aCur = anInterpolater1.Curve(); - gp_Vec aFirstTang1, aLastTang1; - aCur->D1(aCur->FirstParameter(), aP, aFirstTang1); - aCur->D1(aCur->LastParameter(), aP, aLastTang1); - di << " Tang1 after compute = " << aFirstTang1.X() << " " << aFirstTang1.Y() << " " - << aFirstTang1.Z() << "\n"; - di << " Tang2 after compute = " << aLastTang1.X() << " " << aLastTang1.Y() << " " - << aLastTang1.Z() << "\n"; - if (aFirstTang.IsEqual(aFirstTang1, Precision::Confusion(), Precision::Angular())) - { - di << "First tangent is OK\n"; - } - else - { - di << "Faulty : first tangent is wrong\n"; - } - if (aLastTang.IsEqual(aLastTang1, Precision::Confusion(), Precision::Angular())) - { - di << "Last tangent is OK\n"; - } - else - { - di << "Faulty : last tangent is wrong\n"; - } - return 0; -} - static Standard_Integer BUC60944(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc != 2) @@ -1109,103 +1048,6 @@ static Standard_Integer OCC2932_SetRelation(Draw_Interpretor& di, return 0; } -static Standard_Integer OCC3277(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 2) - { - di << "Usage : " << argv[0] << " string\n"; - return 1; - } - TCollection_ExtendedString ExtendedString; - TCollection_ExtendedString InputString(argv[1]); - ExtendedString.Cat(InputString); - // ExtendedString.Print(std::cout); - Standard_SStream aSStream; - ExtendedString.Print(aSStream); - di << aSStream; - return 0; -} - -static Standard_Integer OCC6794(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc > 2) - { - di << "Usage: " << argv[0] << " [nb]\n"; - return 1; - } - - char* max = ::getenv("MMGT_THRESHOLD"); - - Standard_Integer aNb = 1; - if (max) - aNb += Draw::Atoi(max); - else - aNb += 40000; - - if (argc > 1) - aNb = Draw::Atoi(argv[1]); - - di << "Use nb = " << aNb << "\n"; - - const char* c = "a"; - { - TCollection_AsciiString anAscii; - for (int i = 1; i <= aNb; i++) - { - anAscii += TCollection_AsciiString(c); - } - Standard_Integer aLength = anAscii.Length(); - di << "aLength = " << aLength << "\n"; - } - return 0; -} - -static Standard_Integer OCC16485(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc > 1) - { - di << "Usage: " << argv[0] << "\n"; - return 1; - } - - // Create points with X coordinate from varying from 0. to 1000. - // anc compute cumulative bounding box by adding boxes for all the - // points, enlarged on tolerance - - Standard_Real tol = 1e-3; - int nbstep = 1000; - Bnd_Box Box; - for (int i = 0; i <= nbstep; i++) - { - gp_Pnt p(i, 0., 0.); - Bnd_Box B; - B.Add(p); - B.Enlarge(tol); - B.Add(Box); - Box = B; // in this case XMin of Box will grow each time - } - - Standard_Real xmin, ymin, zmin, xmax, ymax, zmax; - Box.Get(xmin, ymin, zmin, xmax, ymax, zmax); - // std::cout.precision(16); - // std::cout << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = - // " << tol << std::endl; - di << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol - << "\n"; - if (Abs(xmin + tol) > 1e-10) - di << "TEST FAILED: Xmin must be equal to -1e3!\n"; - else - di << "TEST OK\n"; - // std::cout << "TEST FAILED: Xmin must be equal to -1e3!" << std::endl; - // std::cout << "TEST OK" << std::endl; - // di << "TEST FAILED: Xmin must be equal to -1e3!\n"; - // di << "TEST OK\n"; - return 0; -} - -// Resulting dimensions: Xmin = -0.001 , Xmax = 1000.001 , Tolerance = 0.001 -// TEST OK - void QABugs::Commands_14(Draw_Interpretor& theCommands) { const char* group = "QABugs"; @@ -1236,7 +1078,6 @@ void QABugs::Commands_14(Draw_Interpretor& theCommands) __FILE__, BUC60870, group); - theCommands.Add("BUC60902", "BUC60902", __FILE__, BUC60902, group); theCommands.Add("BUC60944", "BUC60944 path", __FILE__, BUC60944, group); theCommands.Add("BUC60868", "BUC60868 Result Shell", __FILE__, BUC60868, group); theCommands.Add("BUC60924", "BUC60924 curve X Y Z", __FILE__, BUC60924, group); @@ -1282,11 +1123,5 @@ void QABugs::Commands_14(Draw_Interpretor& theCommands) OCC2932_SetRelation, group); - theCommands.Add("OCC3277", "OCC3277 string", __FILE__, OCC3277, group); - - theCommands.Add("OCC6794", "OCC6794 [nb]", __FILE__, OCC6794, group); - - theCommands.Add("OCC16485", "OCC16485", __FILE__, OCC16485, group); - return; } diff --git a/src/Draw/TKQADraw/QABugs/QABugs_16.cxx b/src/Draw/TKQADraw/QABugs/QABugs_16.cxx index 50d39e7ca4..30167db012 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_16.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_16.cxx @@ -98,25 +98,6 @@ static Standard_Integer BUC60848(Draw_Interpretor& di, Standard_Integer argc, co return 0; } -static Standard_Integer BUC60828(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0., 0., 0.), gp_Pnt(0., 0., 1.)); - Standard_Boolean aValue; - aValue = anEdge.Infinite(); - di << "Initial flag : " << (Standard_Integer)aValue << "\n"; - anEdge.Infinite(Standard_True); - Standard_Boolean aValue1; - aValue1 = anEdge.Infinite(); - di << "Current flag : " << (Standard_Integer)aValue1 << "\n"; - if (aValue1) - di << "Flag was set properly.\n"; - else - di << "Faulty : flag was not set properly.\n"; - return 0; -} - static Standard_Integer BUC60814(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc != 1) @@ -418,65 +399,6 @@ static Standard_Integer OCC49(Draw_Interpretor& di, Standard_Integer argc, const return 0; } -static Standard_Integer OCC132(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - /* - OCC132: - ======= - - ... the validation of the name of files in Analyse_DOS and Analyse_UNIX is : - - characters not allowed in DOS/WNT names are - / - : - * - ? - " - < - > - | - and more than one dot in filename. - */ - - if (argc != 2) - { - di << "Usage : " << argv[0] << " DependentName\n"; - return 1; - } - - OSD_SysType SysType1 = OSD_OS2; - OSD_SysType SysType2 = OSD_WindowsNT; - - { - try - { - OCC_CATCH_SIGNALS - OSD_Path Path(argv[1], SysType1); - } - catch (Standard_ProgramError const&) - { - di << "1\n"; - return 0; - } - } - - { - try - { - OCC_CATCH_SIGNALS - OSD_Path Path(argv[1], SysType2); - } - catch (Standard_ProgramError const&) - { - di << "2\n"; - return 0; - } - } - - di << "0\n"; - return 0; -} - static Standard_Integer OCC405(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc != 4) @@ -758,14 +680,12 @@ void QABugs::Commands_16(Draw_Interpretor& theCommands) const char* group = "QABugs"; theCommands.Add("BUC60848", "BUC60848 shape", __FILE__, BUC60848, group); - theCommands.Add("BUC60828", "BUC60828", __FILE__, BUC60828, group); theCommands.Add("BUC60814", "BUC60814", __FILE__, BUC60814, group); theCommands.Add("BUC60774", "BUC60774", __FILE__, BUC60774, group); theCommands.Add("BUC60972", "BUC60972 edge edge plane val text ", __FILE__, BUC60972, group); theCommands.Add("OCC218", "OCC218 name plane Xlabel Ylabel", __FILE__, OCC218bug, group); theCommands.Add("OCC295", "OCC295 edge_result edge1 edge2", __FILE__, OCC295, group); theCommands.Add("OCC49", "OCC49 name", __FILE__, OCC49, group); - theCommands.Add("OCC132", "OCC132 DependentName", __FILE__, OCC132, group); theCommands.Add("OCC405", "OCC405 edge_result edge1 edge2; merge two edges", __FILE__, diff --git a/src/Draw/TKQADraw/QABugs/QABugs_19.cxx b/src/Draw/TKQADraw/QABugs/QABugs_19.cxx index a0ef84e82d..67f637b4c3 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_19.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_19.cxx @@ -51,11 +51,23 @@ #include #include #include +#include #include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include #include #include +#include +#include #include #include #include @@ -77,8 +89,26 @@ Standard_DISABLE_DEPRECATION_WARNINGS #define QCOMPARE(val1, val2) \ di << "Checking " #val1 " == " #val2 << ((val1) == (val2) ? ": OK\n" : ": Error\n") - static Standard_Integer - OCC230(Draw_Interpretor& di, Standard_Integer argc, const char** argv) +#define QVERIFY(val) \ + if (!(val)) \ + { \ + std::cout << "Error: " #val " is false\n"; \ + } + + // Helper function to create conical surface + static Handle(Geom_Surface) + CreateCone(const gp_Pnt& theApex, + const gp_Dir& theDir, + const gp_Dir& theXDir, + Standard_Real theR, + Standard_Real theSemiAngle, + Standard_Real /*theH*/) +{ + gp_Ax3 anAxis(theApex, theDir, theXDir); + return new Geom_ConicalSurface(anAxis, theSemiAngle, theR); +} + +static Standard_Integer OCC230(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc != 4) { @@ -104,91 +134,6 @@ Standard_DISABLE_DEPRECATION_WARNINGS return 0; } -static Standard_Integer OCC23361(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - gp_Pnt p(0, 0, 2); - - gp_Trsf t1, t2; - t1.SetRotation(gp_Ax1(p, gp_Dir(gp_Dir::D::Y)), -0.49328285294022267); - t2.SetRotation(gp_Ax1(p, gp_Dir(gp_Dir::D::Z)), 0.87538474718473880); - - gp_Trsf tComp = t2 * t1; - - gp_Pnt p1(10, 3, 4); - gp_Pnt p2 = p1.Transformed(tComp); - gp_Pnt p3 = p1.Transformed(t1); - p3.Transform(t2); - - // points must be equal - if (!p2.IsEqual(p3, Precision::Confusion())) - di << "ERROR OCC23361: equivalent transformations does not produce equal points\n"; - else - di << "OCC23361: OK\n"; - - return 0; -} - -class IncrementerDecrementer -{ -public: - IncrementerDecrementer(std::atomic* theVal, Standard_Boolean thePositive) - : myVal(theVal), - myPositive(thePositive) - { - } - - void operator()(const size_t) const - { - if (myPositive) - ++(*myVal); - else - --(*myVal); - } - -private: - std::atomic* myVal; - Standard_Boolean myPositive; -}; - -static Standard_Integer OCC22980(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - std::atomic aSum(0); - - // check returned value - QCOMPARE(aSum.fetch_sub(1) - 1, -1); - QCOMPARE(aSum.fetch_add(1) + 1, 0); - QCOMPARE(aSum.fetch_add(1) + 1, 1); - QCOMPARE(aSum.fetch_add(1) + 1, 2); - // QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 0); - // QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 1); - - // check atomicity - aSum = 0; - const int N = 1 << 24; // big enough to ensure concurrency - - // increment - OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, true)); - QCOMPARE(aSum, N); - - // decrement - OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, false)); - QCOMPARE(aSum, 0); - - return 0; -} - -#include -#include -#include -#include -#include -#include -#include - static Standard_Integer OCC23595(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/) @@ -247,16 +192,6 @@ Standard_Integer OCC22611(Draw_Interpretor& di, Standard_Integer argc, const cha return 0; } -Standard_Integer OCC22595(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/) -{ - gp_Mat M0; - di << "M0 = " - << " {" << M0(1, 1) << "} {" << M0(1, 2) << "} {" << M0(1, 3) << "}" - << " {" << M0(2, 1) << "} {" << M0(2, 2) << "} {" << M0(2, 3) << "}" - << " {" << M0(1, 1) << "} {" << M0(1, 2) << "} {" << M0(1, 3) << "}"; - return 0; -} - #include #include #include @@ -726,482 +661,6 @@ static Standard_Integer OCC23945(Draw_Interpretor& /*di*/, Standard_Integer n, c //================================================================================================= -static Standard_Integer OCC11758(Draw_Interpretor& di, Standard_Integer n, const char**) -{ - if (n != 1) - return 1; - - const char* theStr = "0123456789"; - Standard_Integer i, j; - for (i = 0; i < 5; ++i) - { - // TCollection_AsciiString(const Standard_CString astring) - TCollection_AsciiString a(theStr + i); - // IsEqual (const Standard_CString other)const - // assert( a == theStr+i ); - QCOMPARE(a, theStr + i); - - // TCollection_AsciiString(const Standard_CString astring,const Standard_Integer aLen ) - TCollection_AsciiString b(theStr + i, 3); - // assert( b.Length() == 3 ); - // assert( strncmp( b.ToCString(), theStr+i, 3 ) == 0 ); - // assert( strlen( b.ToCString() ) == 3 ); - QCOMPARE(b.Length(), 3); - QCOMPARE(strncmp(b.ToCString(), theStr + i, 3), 0); - QCOMPARE(b.Length(), 3); - - // TCollection_AsciiString(const Standard_Integer aValue) - TCollection_AsciiString c(i); - // assert( c.IsIntegerValue() ); - // assert( c.IntegerValue() == i ); - QCOMPARE(c.IsIntegerValue(), Standard_True); - QCOMPARE(c.IntegerValue(), i); - - // TCollection_AsciiString(const Standard_Real aValue) - TCollection_AsciiString d(0.1 * i); - // assert( d.IsRealValue() ); - // assert( TCollection_AsciiString(3.3) == "3.3"); - QCOMPARE(d.IsRealValue(Standard_True), Standard_True); - QCOMPARE(TCollection_AsciiString("3.3!").IsRealValue(Standard_True), Standard_False); - QCOMPARE(TCollection_AsciiString("3.3!").IsRealValue(Standard_False), Standard_True); - QCOMPARE(TCollection_AsciiString(3.3), "3.3"); - - // TCollection_AsciiString(const TCollection_AsciiString& astring) - TCollection_AsciiString e(d); - // assert( e == d ); - // assert( e.Length() == d.Length() ); - // assert( strcmp( e.ToCString(), d.ToCString() ) == 0 ); - QCOMPARE(e, d); - QCOMPARE(e.Length(), d.Length()); - QCOMPARE(strcmp(e.ToCString(), d.ToCString()), 0); - - // TCollection_AsciiString(const TCollection_AsciiString& astring , - // const Standard_Character other ) - TCollection_AsciiString f(e, '\a'); - // assert( f.Length() == e.Length() + 1 ); - // assert( strncmp( f.ToCString(), e.ToCString(), e.Length() ) == 0 ); - // assert( f.Value( f.Length() ) == '\a'); - QCOMPARE(f.Length(), e.Length() + 1); - QCOMPARE(strncmp(f.ToCString(), e.ToCString(), e.Length()), 0); - QCOMPARE(f.Value(f.Length()), '\a'); - - // TCollection_AsciiString(const TCollection_AsciiString& astring , - // const Standard_CString other ) - TCollection_AsciiString g(f, theStr); - // assert( g.Length() == f.Length() + strlen( theStr )); - // assert( strncmp( g.ToCString(), f.ToCString(), f.Length() ) == 0 ); - // assert( g.Search( theStr ) == f.Length() + 1 ); - QCOMPARE(g.Length(), f.Length() + (Standard_Integer)strlen(theStr)); - QCOMPARE(strncmp(g.ToCString(), f.ToCString(), f.Length()), 0); - QCOMPARE(g.Search(theStr), f.Length() + 1); - - // TCollection_AsciiString(const TCollection_AsciiString& astring , - // const TCollection_AsciiString& other ) - TCollection_AsciiString h(d, a); - // assert( h.Length() == d.Length() + a.Length() ); - // assert( strncmp( h.ToCString(), d.ToCString(), d.Length() ) == 0 ); - // assert( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) == 0 ); - QCOMPARE(h.Length(), d.Length() + a.Length()); - QCOMPARE(strncmp(h.ToCString(), d.ToCString(), d.Length()), 0); - QCOMPARE(strncmp(h.ToCString() + d.Length(), a.ToCString(), a.Length()), 0); - - // AssignCat(const Standard_CString other) - c.AssignCat(a.ToCString()); - // assert( c.Length() == 1 + a.Length() ); - // assert( c.Search( a ) == 2 ); - QCOMPARE(c.Length(), 1 + a.Length()); - QCOMPARE(c.Search(a), 2); - - // AssignCat(const TCollection_AsciiString& other) - Standard_Integer dl = d.Length(); - d.AssignCat(a); - // assert( d.Length() == dl + a.Length() ); - // assert( d.Search( a ) == dl + 1 ); - QCOMPARE(d.Length(), dl + a.Length()); - QCOMPARE(d.Search(a), dl + 1); - - // Capitalize() - TCollection_AsciiString capitalize("aBC"); - capitalize.Capitalize(); - // assert( capitalize == "Abc" ); - QCOMPARE(capitalize, "Abc"); - - // Copy(const Standard_CString fromwhere) - d = theStr + i; - // assert( d == theStr+i ); - QCOMPARE(d, theStr + i); - - // Copy(const TCollection_AsciiString& fromwhere) - d = h; - // IsEqual (const TCollection_AsciiString& other)const - // assert( d == h ); - QCOMPARE(d, h); - - // Insert(const Standard_Integer where, const Standard_CString what) - dl = d.Length(); - d.Insert(2, theStr); - // assert( d.Length() == dl + strlen( theStr )); - // assert( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) == 0 ); - QCOMPARE(d.Length(), dl + (Standard_Integer)strlen(theStr)); - QCOMPARE(strncmp(d.ToCString() + 1, theStr, strlen(theStr)), 0); - - // Insert(const Standard_Integer where,const Standard_Character what) - d = theStr; - d.Insert(i + 1, 'i'); - // assert( d.Length() == strlen( theStr ) + 1 ); - // assert( d.Value( i+1 ) == 'i'); - // assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 ); - QCOMPARE(d.Length(), (Standard_Integer)strlen(theStr) + 1); - QCOMPARE(d.Value(i + 1), 'i'); - QCOMPARE(strcmp(d.ToCString() + i + 1, theStr + i), 0); - - // Insert(const Standard_Integer where,const TCollection_AsciiString& what) - d = theStr; - d.Insert(i + 1, TCollection_AsciiString("i")); - // assert( d.Length() == strlen( theStr ) + 1 ); - // assert( d.Value( i+1 ) == 'i'); - // assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 ); - QCOMPARE(d.Length(), (Standard_Integer)strlen(theStr) + 1); - QCOMPARE(d.Value(i + 1), 'i'); - QCOMPARE(strcmp(d.ToCString() + i + 1, theStr + i), 0); - - // IsDifferent (const Standard_CString other)const - // assert( d.IsDifferent( theStr )); - // assert( d.IsDifferent( "theStr" )); - // assert( d.IsDifferent( "" )); - // assert( !d.IsDifferent( d.ToCString() )); - QCOMPARE(d.IsDifferent(theStr), Standard_True); - QCOMPARE(d.IsDifferent("theStr"), Standard_True); - QCOMPARE(d.IsDifferent(""), Standard_True); - QCOMPARE(!d.IsDifferent(d.ToCString()), Standard_True); - - // IsDifferent (const TCollection_AsciiString& other)const - // assert( d.IsDifferent( TCollection_AsciiString() )); - // assert( d.IsDifferent( a )); - // assert( d.IsDifferent( h )); - // assert( !d.IsDifferent( d )); - QCOMPARE(d.IsDifferent(TCollection_AsciiString::EmptyString()), Standard_True); - QCOMPARE(d.IsDifferent(a), Standard_True); - QCOMPARE(d.IsDifferent(h), Standard_True); - QCOMPARE(!d.IsDifferent(d), Standard_True); - - // IsLess (const Standard_CString other)const - // assert( TCollection_AsciiString ("0"). IsLess("1")); - // assert( TCollection_AsciiString ("0"). IsLess("00")); - // assert( TCollection_AsciiString (""). IsLess("0")); - // assert( !TCollection_AsciiString("1"). IsLess("0")); - // assert( !TCollection_AsciiString("00").IsLess("0")); - // assert( !TCollection_AsciiString("0"). IsLess("")); - // assert( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1)); - QCOMPARE(TCollection_AsciiString("0").IsLess("1"), Standard_True); - QCOMPARE(TCollection_AsciiString("0").IsLess("00"), Standard_True); - QCOMPARE(TCollection_AsciiString("").IsLess("0"), Standard_True); - QCOMPARE(!TCollection_AsciiString("1").IsLess("0"), Standard_True); - QCOMPARE(!TCollection_AsciiString("00").IsLess("0"), Standard_True); - QCOMPARE(!TCollection_AsciiString("0").IsLess(""), Standard_True); - QCOMPARE(TCollection_AsciiString(theStr + i).IsLess(theStr + i + 1), Standard_True); - - // IsLess (const TCollection_AsciiString& other)const - // assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" ))); - // assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00"))); - // assert( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" ))); - // assert( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" ))); - // assert( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" ))); - // assert( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" ))); - // assert( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1))); - QCOMPARE(TCollection_AsciiString("0").IsLess(TCollection_AsciiString("1")), Standard_True); - QCOMPARE(TCollection_AsciiString("0").IsLess(TCollection_AsciiString("00")), Standard_True); - QCOMPARE(TCollection_AsciiString("").IsLess(TCollection_AsciiString("0")), Standard_True); - QCOMPARE(!TCollection_AsciiString("1").IsLess(TCollection_AsciiString("0")), Standard_True); - QCOMPARE(!TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0")), Standard_True); - QCOMPARE(!TCollection_AsciiString("0").IsLess(TCollection_AsciiString("")), Standard_True); - QCOMPARE(TCollection_AsciiString(theStr + i).IsLess(TCollection_AsciiString(theStr + i + 1)), - Standard_True); - - // IsGreater (const Standard_CString other)const - // assert( !TCollection_AsciiString("0"). IsGreater("1")); - // assert( !TCollection_AsciiString("0"). IsGreater("00")); - // assert( !TCollection_AsciiString(""). IsGreater("0")); - // assert( TCollection_AsciiString ("1"). IsGreater("0")); - // assert( TCollection_AsciiString ("00").IsGreater("0")); - // assert( TCollection_AsciiString ("0"). IsGreater("")); - // assert( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i)); - QCOMPARE(!TCollection_AsciiString("0").IsGreater("1"), Standard_True); - QCOMPARE(!TCollection_AsciiString("0").IsGreater("00"), Standard_True); - QCOMPARE(!TCollection_AsciiString("").IsGreater("0"), Standard_True); - QCOMPARE(TCollection_AsciiString("1").IsGreater("0"), Standard_True); - QCOMPARE(TCollection_AsciiString("00").IsGreater("0"), Standard_True); - QCOMPARE(TCollection_AsciiString("0").IsGreater(""), Standard_True); - QCOMPARE(TCollection_AsciiString(theStr + i + 1).IsGreater(theStr + i), Standard_True); - - // IsGreater (const TCollection_AsciiString& other)const - // assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" ))); - // assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00"))); - // assert( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" ))); - // assert( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" ))); - // assert( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" ))); - // assert( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" ))); - // assert( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i))); - QCOMPARE(!TCollection_AsciiString("0").IsGreater(TCollection_AsciiString("1")), Standard_True); - QCOMPARE(!TCollection_AsciiString("0").IsGreater(TCollection_AsciiString("00")), Standard_True); - QCOMPARE(!TCollection_AsciiString("").IsGreater(TCollection_AsciiString("0")), Standard_True); - QCOMPARE(TCollection_AsciiString("1").IsGreater(TCollection_AsciiString("0")), Standard_True); - QCOMPARE(TCollection_AsciiString("00").IsGreater(TCollection_AsciiString("0")), Standard_True); - QCOMPARE(TCollection_AsciiString("0").IsGreater(TCollection_AsciiString("")), Standard_True); - QCOMPARE(TCollection_AsciiString(theStr + i + 1).IsGreater(TCollection_AsciiString(theStr + i)), - Standard_True); - - // void Read(Standard_IStream& astream) - std::istringstream is(theStr); - e.Read(is); - // assert( e == theStr ); - QCOMPARE(e, theStr); - - // Standard_Integer SearchFromEnd (const Standard_CString what)const - // assert( e.SearchFromEnd( theStr + i ) == i + 1 ); - QCOMPARE(e.SearchFromEnd(theStr + i), i + 1); - - // SetValue(const Standard_Integer where, const Standard_CString what) - e.SetValue(i + 1, "what"); - // assert( e.Search( "what" ) == i+1 ); - // assert( e.Length() == strlen( theStr )); - QCOMPARE(e.Search("what"), i + 1); - QCOMPARE(e.Length(), (Standard_Integer)strlen(theStr)); - - // TCollection_AsciiString Split (const Standard_Integer where) - e = theStr; - d = e.Split(i + 1); - // assert( d.Length() + e.Length() == strlen( theStr )); - QCOMPARE(d.Length() + e.Length(), (Standard_Integer)strlen(theStr)); - - // TCollection_AsciiString SubString (const Standard_Integer FromIndex, - // const Standard_Integer ToIndex) const - e = theStr; - d = e.SubString((unsigned int)i + 1, (unsigned int)i + 3); - // assert( d.Length() == 3 ); - // assert( d.Value(1) == theStr[ i ]); - QCOMPARE(d.Length(), 3); - QCOMPARE(d.Value(1), theStr[i]); - - // TCollection_AsciiString Token (const Standard_CString separators, - // const Standard_Integer whichone) const - e = " "; - for (j = 0; j < i; ++j) - { - e += TCollection_AsciiString(theStr[j]) + " "; - // assert( e.Token(" ", j+1 ) == TCollection_AsciiString( theStr+j, 1 )); - QCOMPARE(e.Token(" ", j + 1), TCollection_AsciiString(theStr + j, 1)); - } - } - for (i = 0; i < 5; ++i) - { - // TCollection_ExtendedString (const Standard_CString astring, - // const Standard_Boolean isMultiByte) - const TCollection_ExtendedString a(theStr + i); - // assert( TCollection_AsciiString( a ) == theStr+i ); - QCOMPARE(TCollection_AsciiString(a), theStr + i); - - // TCollection_ExtendedString (const Standard_ExtString astring) - const TCollection_ExtendedString b(a.ToExtString()); - // assert( a == b ); - QCOMPARE(a, b); - - // TCollection_ExtendedString (const Standard_Integer length, - // const Standard_ExtCharacter filler ) - const TCollection_ExtendedString c(i, 1); - // assert( c.Length() == i ); - QCOMPARE(c.Length(), i); - if (c.Length() > 0) - { - // assert( c.Value( i ) == 1 ); - QCOMPARE(c.Value(i), 1); - } - - // TCollection_ExtendedString (const Standard_Integer aValue) - TCollection_ExtendedString d(i); - const TCollection_AsciiString da(d); - // assert( da.IsIntegerValue() ); - // assert( da.IntegerValue() == i ); - QCOMPARE(da.IsIntegerValue(), Standard_True); - QCOMPARE(da.IntegerValue(), i); - - // TCollection_ExtendedString (const Standard_Real aValue) - const TCollection_ExtendedString e(0.1 * i); - const TCollection_AsciiString ea(e); - // assert( ea.IsRealValue() ); - // assert( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 ); - QCOMPARE(ea.IsRealValue(), Standard_True); - QCOMPARE(Abs(ea.RealValue() - 0.1 * i) < 1e-10, Standard_True); - - // TCollection_ExtendedString (const TCollection_ExtendedString& astring) - const TCollection_ExtendedString& f(e); - // assert( f.Length() == e.Length()); - // assert( f == e ); - QCOMPARE(f.Length(), e.Length()); - QCOMPARE(f, e); - - // TCollection_ExtendedString (const TCollection_AsciiString& astring) - const TCollection_ExtendedString g(ea); - // assert( g.Length() == ea.Length() ); - // assert( TCollection_AsciiString( g ) == ea ); - QCOMPARE(g.Length(), ea.Length()); - QCOMPARE(TCollection_AsciiString(g), ea); - - // AssignCat (const TCollection_ExtendedString& other) - const TCollection_ExtendedString sep(","); - d.AssignCat(sep); - d.AssignCat(g); - // assert( d.Length() == 2 + g.Length() ); - // assert( d.Token( sep.ToExtString(), 1 ) == TCollection_ExtendedString( i )); - // assert( d.Token( sep.ToExtString(), 2 ) == g ); - QCOMPARE(d.Length(), 2 + g.Length()); - QCOMPARE(d.Token(sep.ToExtString(), 1), TCollection_ExtendedString(i)); - QCOMPARE(d.Token(sep.ToExtString(), 2), g); - - // TCollection_ExtendedString Cat (const TCollection_ExtendedString& other) const - const TCollection_ExtendedString cat = a.Cat(sep); - // assert( cat.Length() == a.Length() + sep.Length() ); - // assert( cat.Search( a ) == 1 ); - // assert( cat.Search( sep ) == a.Length() + 1 ); - QCOMPARE(cat.Length(), a.Length() + sep.Length()); - QCOMPARE(cat.Search(a), 1); - QCOMPARE(cat.Search(sep), a.Length() + 1); - - // Copy (const TCollection_ExtendedString& fromwhere) - d = cat; - // assert( d.Length() == cat.Length() ); - // assert( d == cat ); - QCOMPARE(d.Length(), cat.Length()); - QCOMPARE(d, cat); - - // IsEqual (const Standard_ExtString other) const - // assert( d.IsEqual( d.ToExtString() )); - QCOMPARE(d.IsEqual(d.ToExtString()), Standard_True); - - // IsDifferent (const Standard_ExtString other ) const - // assert( d.IsDifferent( a.ToExtString() )); - QCOMPARE(d.IsDifferent(a.ToExtString()), Standard_True); - - // IsDifferent (const TCollection_ExtendedString& other) const - // assert( d.IsDifferent( a )); - QCOMPARE(d.IsDifferent(a), Standard_True); - - // IsLess (const Standard_ExtString other) const - const TCollection_ExtendedString l0("0"), l1("1"), l00("00"), l, ls(theStr + i), - ls1(theStr + i + 1); - // assert( l0. IsLess( l1.ToExtString() )); - // assert( l0. IsLess( l00.ToExtString() )); - // assert( l. IsLess( l0.ToExtString() )); - // assert( ! l1. IsLess( l0.ToExtString() )); - // assert( ! l00.IsLess( l0.ToExtString() )); - // assert( ! l0. IsLess( l.ToExtString() )); - // assert( ls.IsLess( ls1.ToExtString() )); - QCOMPARE(l0.IsLess(l1.ToExtString()), Standard_True); - QCOMPARE(l0.IsLess(l00.ToExtString()), Standard_True); - QCOMPARE(l.IsLess(l0.ToExtString()), Standard_True); - QCOMPARE(!l1.IsLess(l0.ToExtString()), Standard_True); - QCOMPARE(!l00.IsLess(l0.ToExtString()), Standard_True); - QCOMPARE(!l0.IsLess(l.ToExtString()), Standard_True); - QCOMPARE(ls.IsLess(ls1.ToExtString()), Standard_True); - - // IsLess (const TCollection_ExtendedString& other) const - // assert( l0. IsLess( l1 )); - // assert( l0. IsLess( l00 )); - // assert( l. IsLess( l0 )); - // assert( ! l1. IsLess( l0 )); - // assert( ! l00.IsLess( l0 )); - // assert( ! l0. IsLess( l )); - // assert( ls.IsLess( ls1 )); - QCOMPARE(l0.IsLess(l1), Standard_True); - QCOMPARE(l0.IsLess(l00), Standard_True); - QCOMPARE(l.IsLess(l0), Standard_True); - QCOMPARE(!l1.IsLess(l0), Standard_True); - QCOMPARE(!l00.IsLess(l0), Standard_True); - QCOMPARE(!l0.IsLess(l), Standard_True); - QCOMPARE(ls.IsLess(ls1), Standard_True); - - // IsGreater (const Standard_ExtString other) const - // assert( ! l0.IsGreater( l1.ToExtString() )); - // assert( ! l0.IsGreater( l00.ToExtString() )); - // assert( ! l. IsGreater( l0.ToExtString() )); - // assert( l1. IsGreater( l0.ToExtString() )); - // assert( l00.IsGreater( l0.ToExtString() )); - // assert( l0. IsGreater( l.ToExtString() )); - // assert( ls1.IsGreater( ls.ToExtString() )); - QCOMPARE(!l0.IsGreater(l1.ToExtString()), Standard_True); - QCOMPARE(!l0.IsGreater(l00.ToExtString()), Standard_True); - QCOMPARE(!l.IsGreater(l0.ToExtString()), Standard_True); - QCOMPARE(l1.IsGreater(l0.ToExtString()), Standard_True); - QCOMPARE(l00.IsGreater(l0.ToExtString()), Standard_True); - QCOMPARE(l0.IsGreater(l.ToExtString()), Standard_True); - QCOMPARE(ls1.IsGreater(ls.ToExtString()), Standard_True); - - // IsGreater (const TCollection_ExtendedString& other) const - // assert( ! l0.IsGreater( l1)); - // assert( ! l0.IsGreater( l00)); - // assert( ! l. IsGreater( l0)); - // assert( l1. IsGreater( l0)); - // assert( l00.IsGreater( l0)); - // assert( l0. IsGreater( l)); - // assert( ls1.IsGreater( ls)); - QCOMPARE(!l0.IsGreater(l1), Standard_True); - QCOMPARE(!l0.IsGreater(l00), Standard_True); - QCOMPARE(!l.IsGreater(l0), Standard_True); - QCOMPARE(l1.IsGreater(l0), Standard_True); - QCOMPARE(l00.IsGreater(l0), Standard_True); - QCOMPARE(l0.IsGreater(l), Standard_True); - QCOMPARE(ls1.IsGreater(ls), Standard_True); - - // ========================== - // TCollection_HAsciiString:: - // ========================== - - // IsDifferent(const Handle(TCollection_HAsciiString)& S) - Handle(TCollection_HAsciiString) ha1 = new TCollection_HAsciiString(theStr + i); - Handle(TCollection_HAsciiString) ha2 = new TCollection_HAsciiString(theStr + i + 1); - // assert( ha1->IsDifferent( ha2 )); - // assert( !ha1->IsDifferent( ha1 )); - QCOMPARE(ha1->IsDifferent(ha2), Standard_True); - QCOMPARE(!ha1->IsDifferent(ha1), Standard_True); - - // IsSameString (const Handle(TCollection_HAsciiString)& S) - // assert( !ha1->IsSameString( ha2 )); - // assert( ha1->IsSameString( ha1 )); - QCOMPARE(!ha1->IsSameString(ha2), Standard_True); - QCOMPARE(ha1->IsSameString(ha1), Standard_True); - - // IsSameState (const Handle(TCollection_HAsciiString)& other) const - // assert( !ha1->IsSameState( ha2 )); - // assert( ha1->IsSameState( ha1 )); - QCOMPARE(!ha1->IsSameState(ha2), Standard_True); - QCOMPARE(ha1->IsSameState(ha1), Standard_True); - - // IsSameString (const Handle(TCollection_HAsciiString)& S , - // const Standard_Boolean CaseSensitive) const - // assert( !ha1->IsSameString( ha2, true )); - // assert( ha1->IsSameString( ha1, true )); - // assert( !ha1->IsSameString( ha2, false )); - // assert( ha1->IsSameString( ha1, false )); - QCOMPARE(!ha1->IsSameString(ha2, Standard_True), Standard_True); - QCOMPARE(ha1->IsSameString(ha1, Standard_True), Standard_True); - QCOMPARE(!ha1->IsSameString(ha2, Standard_False), Standard_True); - QCOMPARE(ha1->IsSameString(ha1, Standard_False), Standard_True); - - ha1->SetValue(1, "AbC0000000"); - ha2->SetValue(1, "aBc0000000"); - // assert( !ha1->IsSameString( ha2, true )); - // assert( ha1->IsSameString( ha2, false )); - QCOMPARE(!ha1->IsSameString(ha2, Standard_True), Standard_True); - QCOMPARE(ha1->IsSameString(ha2, Standard_False), Standard_True); - } - return 0; -} - -#include -#include -#include -#include - static Standard_Integer OCC24005(Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv) @@ -1404,123 +863,6 @@ static Standard_Integer OCC24137(Draw_Interpretor& theDI, } //! Check boolean operations on NCollection_Map -static Standard_Integer OCC24271(Draw_Interpretor& di, - Standard_Integer /*theArgNb*/, - const char** /*theArgVec*/) -{ - // input data - const Standard_Integer aLeftLower = 1; - const Standard_Integer aLeftUpper = 10; - const Standard_Integer aRightLower = 5; - const Standard_Integer aRightUpper = 15; - - // define arguments - NCollection_Map aMapLeft; - for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aLeftUpper; ++aKeyIter) - { - aMapLeft.Add(aKeyIter); - } - - NCollection_Map aMapRight; - for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aRightUpper; ++aKeyIter) - { - aMapRight.Add(aKeyIter); - } - - QCOMPARE(NCollection_MapAlgo::Contains(aMapLeft, aMapRight), Standard_False); - QCOMPARE(NCollection_MapAlgo::Contains(aMapRight, aMapLeft), Standard_False); - - // validate Union operation - NCollection_Map aMapUnion; - NCollection_MapAlgo::Union(aMapUnion, aMapLeft, aMapRight); - QCOMPARE(aMapUnion.Extent(), aRightUpper - aLeftLower + 1); - for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aRightUpper; ++aKeyIter) - { - QCOMPARE(aMapUnion.Contains(aKeyIter), Standard_True); - } - - // validate Intersection operation - NCollection_Map aMapSect; - NCollection_MapAlgo::Intersection(aMapSect, aMapLeft, aMapRight); - QCOMPARE(aMapSect.Extent(), aLeftUpper - aRightLower + 1); - for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter) - { - QCOMPARE(aMapSect.Contains(aKeyIter), Standard_True); - } - QCOMPARE(NCollection_MapAlgo::Contains(aMapLeft, aMapSect), Standard_True); - QCOMPARE(NCollection_MapAlgo::Contains(aMapRight, aMapSect), Standard_True); - - // validate Substruction operation - NCollection_Map aMapSubsLR; - NCollection_MapAlgo::Subtraction(aMapSubsLR, aMapLeft, aMapRight); - QCOMPARE(aMapSubsLR.Extent(), aRightLower - aLeftLower); - for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter) - { - QCOMPARE(aMapSubsLR.Contains(aKeyIter), Standard_True); - } - - NCollection_Map aMapSubsRL; - NCollection_MapAlgo::Subtraction(aMapSubsRL, aMapRight, aMapLeft); - QCOMPARE(aMapSubsRL.Extent(), aRightUpper - aLeftUpper); - for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter) - { - QCOMPARE(aMapSubsRL.Contains(aKeyIter), Standard_True); - } - - // validate Difference operation - NCollection_Map aMapDiff; - NCollection_MapAlgo::Difference(aMapDiff, aMapLeft, aMapRight); - QCOMPARE(aMapDiff.Extent(), aRightLower - aLeftLower + aRightUpper - aLeftUpper); - for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter) - { - QCOMPARE(aMapDiff.Contains(aKeyIter), Standard_True); - } - for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter) - { - QCOMPARE(aMapDiff.Contains(aKeyIter), Standard_True); - } - - // validate Exchange operation - NCollection_Map aMapSwap; - aMapSwap.Exchange(aMapSect); - for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter) - { - QCOMPARE(aMapSwap.Contains(aKeyIter), Standard_True); - } - QCOMPARE(aMapSect.IsEmpty(), Standard_True); - aMapSwap.Add(34); - aMapSect.Add(43); - - NCollection_Map aMapCopy(aMapSwap); - QCOMPARE(NCollection_MapAlgo::IsEqual(aMapCopy, aMapSwap), Standard_True); - aMapCopy.Remove(34); - aMapCopy.Add(43); - QCOMPARE(NCollection_MapAlgo::IsEqual(aMapCopy, aMapSwap), Standard_False); - - return 0; -} - -#define QVERIFY(val1) \ - di << "Checking " #val1 " == Standard_True" << ((val1) == Standard_True ? ": OK\n" : ": Error\n") - -#include - -namespace -{ -static Handle(Geom_ConicalSurface) CreateCone(const gp_Pnt& theLoc, - const gp_Dir& theDir, - const gp_Dir& theXDir, - const Standard_Real theRad, - const Standard_Real theSin, - const Standard_Real theCos) -{ - const Standard_Real anA = atan(theSin / theCos); - gp_Ax3 anAxis(theLoc, theDir, theXDir); - Handle(Geom_ConicalSurface) aSurf = new Geom_ConicalSurface(anAxis, anA, theRad); - return aSurf; -} -} // namespace - static Standard_Integer OCC23972(Draw_Interpretor& /*theDI*/, Standard_Integer theNArg, const char** theArgs) @@ -1621,42 +963,6 @@ static Standard_Integer OCC24370(Draw_Interpretor& di, Standard_Integer argc, co return 0; } -template -static void DoIsNull(Draw_Interpretor& di) -{ - HT aHandle; - // QVERIFY (aHandle.IsNull()); - QCOMPARE(aHandle.IsNull(), Standard_True); - const T* p = aHandle.get(); -#if OCC_VERSION_HEX > 0x060700 - // QVERIFY (!p); - // QVERIFY (p == 0); - QCOMPARE(!p, Standard_True); - QCOMPARE(p == 0, Standard_True); -#endif - - aHandle = new T; - // QVERIFY (!aHandle.IsNull()); - QCOMPARE(!aHandle.IsNull(), Standard_True); - p = aHandle.get(); - // QVERIFY (p); - // QVERIFY (p != 0); - QCOMPARE(p != NULL, Standard_True); - QCOMPARE(p != 0, Standard_True); -} - -//================================================================================================= - -static Standard_Integer OCC24533(Draw_Interpretor& di, Standard_Integer n, const char**) -{ - if (n != 1) - return 1; - - DoIsNull(di); - - return 0; -} - // Dummy class to test interface for compilation issues class QABugs_HandleClass : public Standard_Transient { @@ -3102,7 +2408,7 @@ struct OCC25545_Functor // purpose : Tests data race when concurrently accessing TopLoc_Location::Transformation() //======================================================================= -static Standard_Integer OCC25545(Draw_Interpretor& di, Standard_Integer, const char**) +static Standard_Integer OCC25545(Draw_Interpretor& /*di*/, Standard_Integer, const char**) { // Place vertices in a vector, giving the i-th vertex the // transformation that translates it on the vector (i,0,0) from the origin. @@ -5366,11 +4672,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) group); theCommands.Add("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group); - theCommands.Add("OCC23361", "OCC23361", __FILE__, OCC23361, group); - theCommands.Add("OCC22980", "OCC22980", __FILE__, OCC22980, group); theCommands.Add("OCC23595", "OCC23595", __FILE__, OCC23595, group); theCommands.Add("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group); - theCommands.Add("OCC22595", "OCC22595", __FILE__, OCC22595, group); theCommands.Add("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group); theCommands.Add("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group); theCommands.Add("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group); @@ -5387,13 +4690,10 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) OCC23945, group); theCommands.Add("OCC24008", "OCC24008 curve surface", __FILE__, OCC24008, group); - theCommands.Add("OCC11758", "OCC11758", __FILE__, OCC11758, group); theCommands.Add("OCC24005", "OCC24005 result", __FILE__, OCC24005, group); theCommands.Add("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group); - theCommands.Add("OCC24271", "Boolean operations on NCollection_Map", __FILE__, OCC24271, group); theCommands.Add("OCC23972", "OCC23972", __FILE__, OCC23972, group); theCommands.Add("OCC24370", "OCC24370 edge pcurve surface prec", __FILE__, OCC24370, group); - theCommands.Add("OCC24533", "OCC24533", __FILE__, OCC24533, group); theCommands.Add("OCC24086", "OCC24086 face wire", __FILE__, OCC24086, group); theCommands.Add("OCC24667", "OCC24667 result Wire_spine Profile [Mode [Approx]], no args to get help", diff --git a/src/Draw/TKQADraw/QABugs/QABugs_20.cxx b/src/Draw/TKQADraw/QABugs/QABugs_20.cxx index 7590b2f1a6..c1c1fcb64d 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_20.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_20.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -3075,259 +3076,6 @@ static Standard_Integer OCC28131(Draw_Interpretor&, #include #include #include -#include -#include - -static Standard_Integer OCC29289(Draw_Interpretor&, Standard_Integer, const char**) -{ - gp_Elips2d e1(gp_Ax2d(gp_Pnt2d(0., 0.), gp_Dir2d(gp_Dir2d::D::X)), 2., 1.); - Handle(Geom2d_Ellipse) Ge1 = new Geom2d_Ellipse(e1); - gp_Elips2d e2(gp_Ax2d(gp_Pnt2d(0.5, 0.5), gp_Dir2d(1., 1.)), 2., 1.); - Handle(Geom2d_Ellipse) Ge2 = new Geom2d_Ellipse(e2); - - Standard_Integer err = 0; - Geom2dAPI_InterCurveCurve Intersector; - Intersector.Init(Ge1, Ge2, 1.e-7); - if (Intersector.NbPoints() == 0) - { - std::cout << "Error: intersector is not done \n"; - err = 1; - } - - Standard_Real A, B, C, D, E; - A = 1.875; - B = -.75; - C = -.5; - D = -.25; - E = -.25; - math_TrigonometricEquationFunction MyF(A, B, C, D, E); - Standard_Real X, Tol1, Eps, Teta, TetaNewton; - Tol1 = 1.e-15; - Eps = 1.5e-12; - Standard_Integer Nit[] = {5, 6, 7, 6}; - - Standard_Real TetaPrev = 0.; - Standard_Integer i; - for (i = 1; i <= Intersector.NbPoints(); i++) - { - Teta = Intersector.Intersector().Point(i).ParamOnFirst(); - X = Teta - 0.1 * (Teta - TetaPrev); - TetaPrev = Teta; - math_NewtonFunctionRoot Resol(MyF, X, Tol1, Eps, Nit[i - 1]); - if (Resol.IsDone()) - { - TetaNewton = Resol.Root(); - if (Abs(Teta - TetaNewton) > 1.e-7) - { - std::cout << "Error: Newton root is wrong for " << Teta << " \n"; - err = 1; - } - } - else - { - std::cout << "Error: Newton is not done for " << Teta << " \n"; - err = 1; - } - } - - return err; -} - -//=============================================================================================== -Standard_Boolean IsSameGuid(const Standard_GUID& aGuidNull, const Standard_GUID& aGuid2) -{ - Standard_Boolean isSame(Standard_False); - if (aGuidNull == aGuid2) - { - aGuid2.ShallowDump(std::cout); - isSame = Standard_True; - } - else - { - aGuid2.ShallowDump(std::cout); - std::cout << std::endl; - } - return isSame; -} - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define QCOMPARE(val1, val2) \ - di << "Checking " #val1 " == " #val2 << ((val1) == (val2) ? ": OK\n" : ": Error\n") - -static Standard_Integer OCC29371(Draw_Interpretor& di, Standard_Integer n, const char** a) -{ - if (n != 1) - { - std::cout << "Usage : " << a[0] << "\n"; - return 1; - } - - Handle(TDocStd_Application) anApp = DDocStd::GetApplication(); - Handle(TDocStd_Document) aDoc; - anApp->NewDocument("BinOcaf", aDoc); - TDF_Label aLab = aDoc->Main(); - Standard_GUID aNullGuid("00000000-0000-0000-0000-000000000000"); - Standard_Boolean IsNullGuid(Standard_False); - - try - { - // 1. Set TDataStd_AsciiString - Handle(TDataStd_AsciiString) aStrAtt = new TDataStd_AsciiString(); - aLab.AddAttribute(aStrAtt); - if (!aStrAtt.IsNull()) - { - Standard_GUID aGuid = aStrAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 2. Set TDataStd_BooleanArray - Handle(TDataStd_BooleanArray) aBArAtt = new TDataStd_BooleanArray(); - aLab.AddAttribute(aBArAtt); - if (!aBArAtt.IsNull()) - { - Standard_GUID aGuid = aBArAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 3. Set TDataStd_BooleanList - Handle(TDataStd_BooleanList) aBListAtt = new TDataStd_BooleanList(); - aLab.AddAttribute(aBListAtt); - if (!aBListAtt.IsNull()) - { - Standard_GUID aGuid = aBListAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 4. Set TDataStd_ByteArray - Handle(TDataStd_ByteArray) aByteArAtt = new TDataStd_ByteArray(); - aLab.AddAttribute(aByteArAtt); - if (!aByteArAtt.IsNull()) - { - Standard_GUID aGuid = aByteArAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 5. Set TDataStd_ExtStringArray - Handle(TDataStd_ExtStringArray) anExtStrArAtt = new TDataStd_ExtStringArray(); - aLab.AddAttribute(anExtStrArAtt); - if (!anExtStrArAtt.IsNull()) - { - Standard_GUID aGuid = anExtStrArAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 6. Set TDataStd_ExtStringList - Handle(TDataStd_ExtStringList) anExtStrListAtt = new TDataStd_ExtStringList(); - aLab.AddAttribute(anExtStrListAtt); - if (!anExtStrListAtt.IsNull()) - { - Standard_GUID aGuid = anExtStrListAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 7. Set TDataStd_Integer - Handle(TDataStd_Integer) anIntAtt = new TDataStd_Integer(); - aLab.AddAttribute(anIntAtt); - if (!anIntAtt.IsNull()) - { - Standard_GUID aGuid = anIntAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 8. Set TDataStd_IntegerArray - Handle(TDataStd_IntegerArray) anIntArrAtt = new TDataStd_IntegerArray(); - aLab.AddAttribute(anIntArrAtt); - if (!anIntArrAtt.IsNull()) - { - Standard_GUID aGuid = anIntArrAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 9. Set TDataStd_IntegerList - Handle(TDataStd_IntegerList) anIntListAtt = new TDataStd_IntegerList(); - aLab.AddAttribute(anIntListAtt); - if (!anIntListAtt.IsNull()) - { - Standard_GUID aGuid = anIntListAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 10. Set TDataStd_Name - Handle(TDataStd_Name) aNameAtt = new TDataStd_Name(); - aLab.AddAttribute(aNameAtt); - if (!aNameAtt.IsNull()) - { - Standard_GUID aGuid = aNameAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 11. Set TDataStd_Real - Handle(TDataStd_Real) aRealAtt = new TDataStd_Real(); - aLab.AddAttribute(aRealAtt); - if (!aRealAtt.IsNull()) - { - Standard_GUID aGuid = aRealAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 12. Set TDataStd_RealArray - Handle(TDataStd_RealArray) aRealArrAtt = new TDataStd_RealArray(); - aLab.AddAttribute(aRealArrAtt); - if (!aRealArrAtt.IsNull()) - { - Standard_GUID aGuid = aRealArrAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 13. Set TDataStd_RealList - Handle(TDataStd_RealList) aRealListAtt = new TDataStd_RealList(); - aLab.AddAttribute(aRealListAtt); - if (!aRealListAtt.IsNull()) - { - Standard_GUID aGuid = aRealListAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 14. Set TDataStd_ReferenceArray - Handle(TDataStd_ReferenceArray) aRefArrAtt = new TDataStd_ReferenceArray(); - aLab.AddAttribute(aRefArrAtt); - if (!aRefArrAtt.IsNull()) - { - Standard_GUID aGuid = aRefArrAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - - // 15. Set TDataStd_ReferenceList - Handle(TDataStd_ReferenceList) aRefListAtt = new TDataStd_ReferenceList(); - aLab.AddAttribute(aRefListAtt); - if (!aRefListAtt.IsNull()) - { - Standard_GUID aGuid = aRefListAtt->ID(); - IsNullGuid = IsSameGuid(aNullGuid, aGuid); - } - } - catch (...) - { - IsNullGuid = Standard_True; - } - QCOMPARE(IsNullGuid, Standard_False); - anApp->Close(aDoc); - return 0; -} #include #include @@ -3507,56 +3255,6 @@ static Standard_Integer OCC29807(Draw_Interpretor& theDI, return 0; } -//======================================================================= -// function : OCC29925 -// purpose : check safety of functions like IsSpace(), LowerCase(), etc. for all chars -//======================================================================= -static Standard_Integer OCC29925(Draw_Interpretor& theDI, Standard_Integer, const char**) -{ - // iterate by all valid ASCII chars (including extended) - for (int i = 0; i < 256; i++) - { - Standard_Character c = (char)(unsigned char)i; - // if (c != i) theDI << c << " != " << i << "\n"; - const char* anOp = ""; - try - { - anOp = "IsAlphabetic"; - IsAlphabetic(c); - anOp = "IsDigit"; - IsDigit(c); - anOp = "IsXDigit"; - IsXDigit(c); - anOp = "IsAlphanumeric"; - IsAlphanumeric(c); - anOp = "IsControl"; - IsControl(c); - anOp = "IsGraphic"; - IsGraphic(c); - anOp = "IsLowerCase"; - IsLowerCase(c); - anOp = "IsPrintable"; - IsPrintable(c); - anOp = "IsPunctuation"; - IsPunctuation(c); - anOp = "IsSpace"; - IsSpace(c); - anOp = "IsUpperCase"; - IsUpperCase(c); - anOp = "LowerCase"; - LowerCase(c); - anOp = "UpperCase"; - UpperCase(c); - } - catch (const Handle(Standard_Failure)& e) - { - theDI << anOp << "() fails for " << c << " (" << e->DynamicType()->Name() << ")\n"; - } - } - - return 0; -} - //======================================================================= // function : OCC29311 // purpose : check performance of OBB calculations @@ -4056,53 +3754,6 @@ static Standard_Integer OCC30435(Draw_Interpretor& di, Standard_Integer, const c return 0; } -//======================================================================= -// function : OCC30708_1 -// purpose : Tests initialization of the TopoDS_Iterator with null shape -//======================================================================= -static Standard_Integer OCC30708_1(Draw_Interpretor& di, Standard_Integer, const char**) -{ - TopoDS_Iterator it; - try - { - OCC_CATCH_SIGNALS - - TopoDS_Shape empty; - it.Initialize(empty); - } - catch (const Standard_Failure&) - { - di << "Cannot initialize TopoDS_Iterator with null shape\n"; - return 0; - } - - if (it.More()) - di << "Incorrect Iterator initialization: method More() returns true on null shape\n"; - - return 0; -} - -//======================================================================= -// function : OCC30708_2 -// purpose : Tests initialization of the BRepLib_MakeWire with null wire -//======================================================================= -static Standard_Integer OCC30708_2(Draw_Interpretor& di, Standard_Integer, const char**) -{ - try - { - OCC_CATCH_SIGNALS - - TopoDS_Wire empty; - BRepLib_MakeWire aWBuilder(empty); - } - catch (const Standard_Failure&) - { - di << "Cannot initialize BRepLib_MakeWire with null wire\n"; - } - - return 0; -} - //================================================================================================= #include @@ -4640,128 +4291,6 @@ static Standard_Integer QANullifyShape(Draw_Interpretor& di, Standard_Integer n, return 0; } -static void CheckAx3Dir(gp_Ax3& theAxis, const gp_Dir& theDir) -{ - Standard_Boolean bDirect = theAxis.Direct(); - theAxis.SetDirection(theDir); - if (bDirect != theAxis.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - } - if (!theDir.IsEqual(theAxis.Direction(), Precision::Angular())) - { - std::cout << "Error: main dir was not set properly\n"; - } -} - -static void CheckAx3DirX(gp_Ax3& theAxis, const gp_Dir& theDir) -{ - Standard_Boolean bDirect = theAxis.Direct(); - theAxis.SetXDirection(theDir); - if (bDirect != theAxis.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - } - gp_Dir aGoodY = theAxis.Direction().Crossed(theDir); - if (theAxis.Direct()) - { - if (!aGoodY.IsEqual(theAxis.YDirection(), Precision::Angular())) - { - std::cout << "Error: X dir was not set properly\n"; - } - } - else - { - if (!aGoodY.IsOpposite(theAxis.YDirection(), Precision::Angular())) - { - std::cout << "Error: X dir was not set properly\n"; - } - } -} - -static void CheckAx3DirY(gp_Ax3& theAxis, const gp_Dir& theDir) -{ - Standard_Boolean bDirect = theAxis.Direct(); - theAxis.SetYDirection(theDir); - if (bDirect != theAxis.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - } - gp_Dir aGoodX = theAxis.Direction().Crossed(theDir); - if (theAxis.Direct()) - { - if (!aGoodX.IsOpposite(theAxis.XDirection(), Precision::Angular())) - { - std::cout << "Error: Y dir was not set properly\n"; - } - } - else - { - if (!aGoodX.IsEqual(theAxis.XDirection(), Precision::Angular())) - { - std::cout << "Error: Y dir was not set properly\n"; - } - } -} - -static void CheckAx3Ax1(gp_Ax3& theAx, const gp_Ax1& theAx0) -{ - Standard_Boolean bDirect = theAx.Direct(); - theAx.SetAxis(theAx0); - if (bDirect != theAx.Direct()) - { - std::cout << "Error: coordinate system is reversed\n"; - } - if (!theAx0.Direction().IsEqual(theAx.Direction(), Precision::Angular())) - { - std::cout << "Error: main dir was not set properly\n"; - } -} - -static Standard_Integer OCC29406(Draw_Interpretor&, Standard_Integer, const char**) -{ - // Main (Z) direction - { - // gp_Ax3::SetDirection() test - gp_Ax3 anAx1, anAx2, anAx3, anAx4, anAx5, anAx6; - anAx3.ZReverse(); - anAx4.ZReverse(); - CheckAx3Dir(anAx1, gp::DX()); - CheckAx3Dir(anAx2, -gp::DX()); - CheckAx3Dir(anAx3, gp::DX()); - CheckAx3Dir(anAx4, -gp::DX()); - // gp_Ax3::SetAxis() test - gp_Ax1 anAx0_1(gp::Origin(), gp::DX()); - gp_Ax1 anAx0_2(gp::Origin(), -gp::DX()); - CheckAx3Ax1(anAx5, anAx0_1); - CheckAx3Ax1(anAx6, anAx0_2); - } - // X direction - { - // gp_Ax3::SetXDirection() test - gp_Ax3 anAx1, anAx2, anAx3, anAx4; - anAx3.XReverse(); - anAx4.XReverse(); - CheckAx3DirX(anAx1, gp::DZ()); - CheckAx3DirX(anAx2, -gp::DZ()); - CheckAx3DirX(anAx3, gp::DZ()); - CheckAx3DirX(anAx4, -gp::DZ()); - } - // Y direction - { - // gp_Ax3::SetYDirection() test - gp_Ax3 anAx1, anAx2, anAx3, anAx4; - anAx3.YReverse(); - anAx4.YReverse(); - CheckAx3DirY(anAx1, gp::DZ()); - CheckAx3DirY(anAx2, -gp::DZ()); - CheckAx3DirY(anAx3, gp::DZ()); - CheckAx3DirY(anAx4, -gp::DZ()); - } - - return 0; -} - #include #include @@ -4800,46 +4329,6 @@ static Standard_Integer OCC32744(Draw_Interpretor& theDi, return 0; } -static Standard_Integer OCC33009(Draw_Interpretor&, Standard_Integer, const char**) -{ - Bnd_OBB aBndBox; - - TColgp_Array1OfPnt aPoints(1, 5); - - aPoints.ChangeValue(1) = gp_Pnt(1, 2, 3); - aPoints.ChangeValue(2) = gp_Pnt(3, 2, 1); - aPoints.ChangeValue(3) = gp_Pnt(2, 3, 1); - aPoints.ChangeValue(4) = gp_Pnt(1, 3, 2); - aPoints.ChangeValue(5) = gp_Pnt(2, 1, 3); - - aBndBox.ReBuild(aPoints, (const TColStd_Array1OfReal*)0, true); - - return 0; -} - -static Standard_Integer OCC33048(Draw_Interpretor&, Standard_Integer, const char**) -{ - Standard_Real isOK = true; - try - { - // This method uses raw pointers for memory manipulations and not used in OCCT. - math_ComputeKronrodPointsAndWeights aCalc(125); - isOK = aCalc.IsDone(); - } - catch (...) - { - isOK = false; - } - - if (isOK) - std::cout << "OK: Kronrod points and weights are calculated successfully." << std::endl; - else - std::cout << "Error: Problem occurred during calculation of Kronrod points and weights." - << std::endl; - - return 0; -} - //================================================================================================= static Standard_Integer OCC33657_1(Draw_Interpretor&, Standard_Integer, const char**) @@ -5209,12 +4698,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) __FILE__, OCC28131, group); - theCommands.Add("OCC29289", - "OCC29289 : searching trigonometric root by Newton iterations", - __FILE__, - OCC29289, - group); - theCommands.Add("OCC29371", "OCC29371", __FILE__, OCC29371, group); theCommands.Add("OCC29430", "OCC29430 " " ", @@ -5228,11 +4711,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) __FILE__, OCC29064, group); - theCommands.Add("OCC29925", - "OCC29925: check safety of character classification functions", - __FILE__, - OCC29925, - group); theCommands.Add("OCC29807", "OCC29807 surface1 surface2 u1 v1 u2 v2", __FILE__, OCC29807, group); theCommands.Add("OCC29311", "OCC29311 shape counter nbiter: check performance of OBB calculation", @@ -5263,18 +4741,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) theCommands.Add("QAEndsWith", "QAEndsWith string endstring", __FILE__, QAEndsWith, group); - theCommands.Add("OCC30708_1", - "Tests initialization of the TopoDS_Iterator with null shape", - __FILE__, - OCC30708_1, - group); - - theCommands.Add("OCC30708_2", - "Tests initialization of the BRepLib_MakeWire with null shape", - __FILE__, - OCC30708_2, - group); - theCommands.Add("OCC30869", "Prints bounding points of the given wire and tangent vectors at these points.\n" "Usage: OCC30869 wire", @@ -5314,23 +4780,12 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) QANullifyShape, group); - theCommands.Add( - "OCC29406", - "Tests the case when newly set axis for gp_Ax3 is parallel to one of current axis", - __FILE__, - OCC29406, - group); - theCommands.Add("OCC32744", "Tests avoid Endless loop in GCPnts_UniformDeflection", __FILE__, OCC32744, group); - theCommands.Add("OCC33009", "Tests the case when", __FILE__, OCC33009, group); - - theCommands.Add("OCC33048", "Kronrod points and weights calculation", __FILE__, OCC33048, group); - theCommands.Add("QACheckBends", "QACheckBends curve [CosMaxAngle [theNbPoints]]", __FILE__, diff --git a/src/Draw/TKQADraw/QABugs/QABugs_3.cxx b/src/Draw/TKQADraw/QABugs/QABugs_3.cxx index 939628ac1b..6e711b71d0 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_3.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_3.cxx @@ -137,65 +137,6 @@ static Standard_Integer BUC60652(Draw_Interpretor& di, Standard_Integer argc, co #include #include -static Standard_Integer BUC60729(Draw_Interpretor& /*di*/, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - Bnd_Box aMainBox; - TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1, 1, 1).Solid(); - - BRepBndLib::Add(aShape, aMainBox); - - Standard_Integer siMaxNbrBox = 6; - Bnd_BoundSortBox m_BoundSortBox; - m_BoundSortBox.Initialize(aMainBox, siMaxNbrBox); - TopExp_Explorer aExplorer(aShape, TopAbs_FACE); - Standard_Integer i; - - // Bnd_Box __emptyBox; // Box is void ! - // Handle(Bnd_HArray1OfBox) __aSetOfBox = new Bnd_HArray1OfBox( 1, siMaxNbrBox, __emptyBox ); - - for (i = 1, aExplorer.ReInit(); aExplorer.More(); aExplorer.Next(), i++) - { - const TopoDS_Shape& aFace = aExplorer.Current(); - Bnd_Box aBox; - BRepBndLib::Add(aFace, aBox); - m_BoundSortBox.Add(aBox, i); - // __aSetOfBox->SetValue( i, aBox ); - } - // m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox ); - - return 0; -} - -static Standard_Integer BUC60724(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - TCollection_AsciiString as1(""); - TCollection_AsciiString as2('\0'); - if (as1.ToCString() == NULL || as1.Length() != 0 || as1.ToCString()[0] != '\0') - di << "Error : the first string is not zero string : " << as1.ToCString() << "\n"; - - if (as2.ToCString() == NULL || as2.Length() != 0 || as2.ToCString()[0] != '\0') - di << "Error : the second string is not zero string : " << as2.ToCString() << "\n"; - - return 0; -} - -#include - -static Standard_Integer BUC60727(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - di << "Program Test\n"; - UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); // length is mm - di << "AnyToLS (3,mm) = " << UnitsAPI::AnyToLS(3., "mm") << "\n"; // result was WRONG. - - return 0; -} - #include #include #include @@ -440,59 +381,6 @@ static int BUC60825(Draw_Interpretor& di, Standard_Integer argc, const char** ar #include #include -static int OCC10006(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 1) - { - di << "Usage : " << argv[0] << "\n"; - return 1; - } - - double bottompoints1[12] = {10, -10, 0, 100, -10, 0, 100, -100, 0, 10, -100, 0}; - double toppoints1[12] = {0, 0, 10, 100, 0, 10, 100, -100, 10, 0, -100, 10}; - double bottompoints2[12] = {0, 0, 10.00, 100, 0, 10.00, 100, -100, 10.00, 0, -100, 10.00}; - double toppoints2[12] = {0, 0, 250, 100, 0, 250, 100, -100, 250, 0, -100, 250}; - BRepBuilderAPI_MakePolygon bottompolygon1, toppolygon1, bottompolygon2, toppolygon2; - gp_Pnt tmppnt; - for (int i = 0; i < 4; i++) - { - tmppnt.SetCoord(bottompoints1[3 * i], bottompoints1[3 * i + 1], bottompoints1[3 * i + 2]); - bottompolygon1.Add(tmppnt); - tmppnt.SetCoord(toppoints1[3 * i], toppoints1[3 * i + 1], toppoints1[3 * i + 2]); - toppolygon1.Add(tmppnt); - tmppnt.SetCoord(bottompoints2[3 * i], bottompoints2[3 * i + 1], bottompoints2[3 * i + 2]); - bottompolygon2.Add(tmppnt); - tmppnt.SetCoord(toppoints2[3 * i], toppoints2[3 * i + 1], toppoints2[3 * i + 2]); - toppolygon2.Add(tmppnt); - } - bottompolygon1.Close(); - DBRep::Set("B1", bottompolygon1.Shape()); - toppolygon1.Close(); - DBRep::Set("T1", toppolygon1.Shape()); - bottompolygon2.Close(); - DBRep::Set("B2", bottompolygon2.Shape()); - toppolygon2.Close(); - DBRep::Set("T2", toppolygon2.Shape()); - BRepOffsetAPI_ThruSections loft1(Standard_True, Standard_True); - loft1.AddWire(bottompolygon1.Wire()); - loft1.AddWire(toppolygon1.Wire()); - loft1.Build(); - BRepOffsetAPI_ThruSections loft2(Standard_True, Standard_True); - loft2.AddWire(bottompolygon2.Wire()); - loft2.AddWire(toppolygon2.Wire()); - loft2.Build(); - if (loft1.Shape().IsNull() || loft2.Shape().IsNull()) - return 1; - DBRep::Set("TS1", loft1.Shape()); - DBRep::Set("TS2", loft2.Shape()); - - di << "BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape())\n"; - BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape()); - DBRep::Set("F", result.Shape()); - - return 0; -} - #include static Standard_Integer BUC60856(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** argv) @@ -581,14 +469,6 @@ static Standard_Integer coordload(Draw_Interpretor& theDi, return 0; } -static Standard_Integer TestMem(Draw_Interpretor& /*di*/, - Standard_Integer /*nb*/, - const char** /*arg*/) -{ - TCollection_ExtendedString aString(1024 * 1024, 'A'); - return 0; -} - static Standard_Integer BUC60876_(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); @@ -611,19 +491,6 @@ static Standard_Integer BUC60876_(Draw_Interpretor& di, Standard_Integer argc, c //================================================================================================= -#include - -static Standard_Integer BUC60773(Draw_Interpretor& /*di*/, - Standard_Integer /*n*/, - const char** /*a*/) -{ - Handle(TCollection_HAsciiString) hAscii = new TCollection_HAsciiString(); - Standard_CString aStr = hAscii->ToCString(); - TCollection_AsciiString aAscii(aStr); - - return 0; -} - #include #include @@ -860,47 +727,6 @@ static Standard_Integer BUC60874(Draw_Interpretor& /*di*/, #include #include -static int BUC60817(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 2) - { - di << "Usage : " << argv[0] << " D\n"; - di << 1; - return 0; - } - - Handle(TDF_Data) DF; - if (!DDF::GetDF(argv[1], DF)) - { - di << 2; - return 0; - } - - TDF_Label L1, L2; - Handle(TDataStd_TreeNode) TN1, TN2; - - DDF::AddLabel(DF, "0:2", L1); - TN1 = TDataStd_TreeNode::Set(L1); - - DDF::AddLabel(DF, "0:3", L2); - TN2 = TDataStd_TreeNode::Set(L2); - - TN1->Append(TN2); - if (!(TN2->IsDescendant(TN1))) - { - di << 3; - return 0; - } - if ((TN1->IsDescendant(TN2))) - { - di << 4; - return 0; - } - - di << 0; - return 0; -} - static int BUC60831_1(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc != 2) @@ -1194,44 +1020,6 @@ static int BUC60910(Draw_Interpretor& di, Standard_Integer argc, const char** ar return 0; } -static int BUC60925(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 2) - { - di << "Usage : " << argv[0] << " D\n"; - di << 1; - return 0; - } - - Handle(TDF_Data) aDF; - if (!DDF::GetDF(argv[1], aDF)) - { - di << 2; - return 0; - } - - TDF_Label L; - DDF::AddLabel(aDF, "0:2", L); - TDF_LabelMap LM; - LM.Add(L); - - Handle(TNaming_NamedShape) NS = new TNaming_NamedShape; - // Handle(TNaming_Name) NN = new TNaming_Name; - TNaming_Name NN; - - NN.Type(TNaming_IDENTITY); - NN.Append(NS); - Standard_Boolean Res = NN.Solve(L, LM); - - if (Res != Standard_False) - { - di << 3; - return 0; - } - di << 0; - return 0; -} - static int BUC60932(Draw_Interpretor& di, Standard_Integer argc, const char** argv) { if (argc != 2) @@ -1418,24 +1206,16 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) theCommands.Add("BUC60632", "BUC60632 mode length", __FILE__, BUC60632, group); theCommands.Add("BUC60652", "BUC60652 face", __FILE__, BUC60652, group); - theCommands.Add("BUC60729", "BUC60729", __FILE__, BUC60729, group); - theCommands.Add("BUC60724", "BUC60724", __FILE__, BUC60724, group); - theCommands.Add("BUC60727", "BUC60727", __FILE__, BUC60727, group); theCommands.Add("BUC60792", "BUC60792", __FILE__, BUC60792, group); theCommands.Add("BUC60811", "BUC60811", __FILE__, BUC60811, group); theCommands.Add("BUC60825", "BUC60825", __FILE__, BUC60825, group); - theCommands.Add("OCC10006", "OCC10006", __FILE__, OCC10006, group); - theCommands.Add("BUC60856", "BUC60856", __FILE__, BUC60856, group); theCommands.Add("coordload", "load coord from file", __FILE__, coordload, group); - theCommands.Add("TestMem", "TestMem", __FILE__, TestMem, group); - theCommands.Add("BUC60945", "BUC60945", __FILE__, TestMem, group); theCommands.Add("BUC60876", "BUC60876 shape", __FILE__, BUC60876_, group); - theCommands.Add("BUC60773", "BUC60773", __FILE__, BUC60773, group); theCommands.Add("TestCMD", "TestCMD", __FILE__, TestCMD, group); @@ -1444,8 +1224,6 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) theCommands.Add("BUC60841", "BUC60841", __FILE__, BUC60841, group); theCommands.Add("BUC60874", "BUC60874", __FILE__, BUC60874, group); - - theCommands.Add("BUC60817", "BUC60817 D", __FILE__, BUC60817, group); theCommands.Add("BUC60831_1", "BUC60831_1 D", __FILE__, BUC60831_1, group); theCommands.Add("BUC60831_2", "BUC60831_2 D Label", __FILE__, BUC60831_2, group); theCommands.Add("BUC60836", "BUC60836 D", __FILE__, BUC60836, group); @@ -1453,7 +1231,6 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) theCommands.Add("BUC60862", "BUC60862 D Shape", __FILE__, BUC60862, group); theCommands.Add("BUC60867", "BUC60867", __FILE__, BUC60867, group); theCommands.Add("BUC60910", "BUC60910 D", __FILE__, BUC60910, group); - theCommands.Add("BUC60925", "BUC60925 D", __FILE__, BUC60925, group); theCommands.Add("BUC60932", "BUC60932 D", __FILE__, BUC60932, group); theCommands.Add("AISWidth", "AISWidth (DOC,entry,[width])", __FILE__, AISWidth, group); theCommands.Add("BUC60921", "BUC60921 Doc label brep_file", __FILE__, BUC60921, group); diff --git a/src/Draw/TKQADraw/QABugs/QABugs_5.cxx b/src/Draw/TKQADraw/QABugs/QABugs_5.cxx index 652129848f..70649073ae 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_5.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_5.cxx @@ -80,37 +80,6 @@ static Standard_Integer OCC6001(Draw_Interpretor& di, Standard_Integer argc, con return 0; } -static Standard_Integer OCC5696(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 1) - { - di << "Usage : " << argv[0] << "\n"; - return 1; - } - TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), gp_Pnt(2, 0, 0)); - TopoDS_Wire wire = BRepBuilderAPI_MakeWire(edge); - BRepAdaptor_CompCurve curve(wire); - Standard_Real first = curve.FirstParameter(); - Standard_Real last = curve.LastParameter(); - Standard_Real par = (first + last) / 2; - Standard_Real par_edge; - TopoDS_Edge edge_found; - try - { - OCC_CATCH_SIGNALS - curve.Edge(par, edge_found, par_edge); // exception is here - di << "par_edge = " << par_edge << "\n"; - } - - catch (Standard_Failure const&) - { - di << "OCC5696 Exception \n"; - return 0; - } - - return 0; -} - void QABugs::Commands_5(Draw_Interpretor& theCommands) { const char* group = "QABugs"; @@ -121,7 +90,5 @@ void QABugs::Commands_5(Draw_Interpretor& theCommands) OCC6001, group); - theCommands.Add("OCC5696", "OCC5696", __FILE__, OCC5696, group); - return; } diff --git a/src/Draw/TKQADraw/QABugs/QABugs_7.cxx b/src/Draw/TKQADraw/QABugs/QABugs_7.cxx index a7fa4ee1a3..f8e92c6dca 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_7.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_7.cxx @@ -19,307 +19,11 @@ #include #include -#include -#include -#include -#include -#include -#include - -const Standard_Integer Glob_NbPoles = 195; -const Standard_Real Glob_Poles[Glob_NbPoles][3] = { - {60000, 31.937047503393231, 799.36226142892554}, - {60000.000000027772, 16.712487623992825, 799.97053069028755}, - {59999.999999875639, 7.3723603687660546, 799.97042131653711}, - {60000.000000331296, 1.2070383839533065, 799.90534456032105}, - {59999.999999361171, -2.5807810139032785, 799.77442818789041}, - {60000.000000952597, -4.7405254527655112, 799.70146419719595}, - {59999.999998867599, -5.3922917628932563, 799.62943054158143}, - {60000.000001091154, -5.1399175234965044, 799.63364074172011}, - {59999.999999142601, -3.6992503431468067, 799.67179299415568}, - {60000.000000546061, -1.6910663098148713, 799.76799688166773}, - {59999.999999725333, 1.1886267067330731, 799.91818018455035}, - {60000.000000101914, 4.5979596894282677, 800.11782874041273}, - {59999.999999977204, 8.5921385739756673, 800.36980220999453}, - {60000.000000018619, 16.600658956791417, 800.90755378048414}, - {59999.999999985768, 26.040687605616604, 801.59827916977554}, - {60000.000000052918, 30.448324872994441, 801.9310695501531}, - {59999.999999883308, 35.089921752286457, 802.29194004854389}, - {60000.000000186978, 39.947755013962528, 802.68007678107051}, - {59999.99999976845, 45.005892525213071, 803.09465896567826}, - {60000.000000227068, 50.249778854659326, 803.53486876081706}, - {59999.999999821659, 55.665932960782108, 803.9998957687626}, - {60000.000000112479, 61.241734208767859, 804.48893829648762}, - {59999.999999943684, 66.965272918611916, 805.00120177704798}, - {60000.000000021486, 72.8252416954995, 805.53589657709654}, - {59999.99999999431, 78.810843745189473, 806.09223572876306}, - {60000.000000004045, 87.962119756404547, 806.95803383418911}, - {59999.99999999725, 97.349976765262795, 807.869010426567}, - {60000.000000017491, 100.50428991828356, 808.17759139897635}, - {59999.99999994829, 103.68239055379394, 808.49099684342912}, - {60000.000000105072, 106.88305649144334, 808.80912918631941}, - {59999.999999835563, 110.10508187457555, 809.13189073948308}, - {60000.000000207947, 113.34727572158297, 809.45918381767103}, - {59999.999999784653, 116.60846040037053, 809.79091039912782}, - {60000.000000180742, 119.88747020406682, 810.12697237079749}, - {59999.999999880296, 123.18314981484644, 810.46727114678265}, - {60000.000000059626, 126.49435287223255, 810.81170785335109}, - {59999.999999979838, 129.81994045902351, 811.16018308253979}, - {60000.000000015229, 134.8281992328765, 811.68880383859914}, - {59999.99999998945, 139.86373510893441, 812.2260602582727}, - {60000.000000059066, 141.54513692067022, 812.40609267860532}, - {59999.999999845008, 143.22928798266199, 812.58705944070834}, - {60000.000000278043, 144.91604799540772, 812.7689478797023}, - {59999.999999621934, 146.60527693312631, 812.95174532592102}, - {60000.000000407505, 148.29683501034282, 813.13543899059755}, - {59999.999999644526, 149.99058265886663, 813.32001613307352}, - {60000.000000252723, 151.68638048575326, 813.5054638442823}, - {59999.999999853622, 153.38408925794459, 813.69176926621947}, - {60000.000000068765, 155.08356985703421, 813.87891939578799}, - {59999.999999973967, 156.7846832610312, 814.06690122038856}, - {60000.00000002468, 159.33859412935516, 814.35010184114628}, - {59999.999999977736, 161.89555354531564, 814.63511466528189}, - {60000.000000145039, 162.74819471256941, 814.73031865086841}, - {59999.999999608634, 163.60113987644607, 814.82572069112655}, - {60000.000000709108, 164.45437167903589, 814.92131914784375}, - {59999.999999031643, 165.3078727497936, 815.0171123286641}, - {60000.000001042623, 166.16162573916125, 815.11309861889924}, - {59999.999999097396, 167.01561326831904, 815.20927628960794}, - {60000.000000630716, 167.86981798631649, 815.30564372626975}, - {59999.999999648215, 168.72422251240596, 815.40219920078994}, - {60000.000000151289, 169.57880948189478, 815.4989410625825}, - {59999.999999954052, 170.43356151298337, 815.5958676029403}, - {60000.000000034408, 171.71591108030151, 815.74153190228753}, - {59999.999999976135, 172.9985538007256, 815.88760410128577}, - {60000.000000129759, 173.42613177350728, 815.93633994702668}, - {59999.999999664251, 173.85373796967124, 815.98512067846866}, - {60000.00000060827, 174.28137021936112, 816.03394612011459}, - {59999.99999914426, 174.70902633885802, 816.08281598496671}, - {60000.000000969369, 175.13670416564241, 816.13173017155248}, - {59999.999999107844, 175.56440150794049, 816.18068832455049}, - {60000.00000066567, 175.9921162052986, 816.22969037578832}, - {59999.999999602165, 176.41984606692156, 816.27873598355484}, - {60000.00000018561, 176.84758892491178, 816.3278250228899}, - {59999.999999935775, 177.27534259516338, 816.37695722529566}, - {60000.000000054533, 177.91698605475608, 816.45071998561696}, - {59999.999999955864, 178.55864403901305, 816.52457892469988}, - {60000.000000281914, 178.7725313764083, 816.54920923644852}, - {59999.999999214248, 178.98641977813006, 816.57385016025694}, - {60000.000001492997, 179.20030898752373, 816.59850173903158}, - {59999.999997853804, 179.41419870083473, 816.62316380941468}, - {60000.000002424618, 179.62808869307457, 816.647836551757}, - {59999.999997816361, 179.84197863289955, 816.6725196831527}, - {60000.000001566797, 180.05586830671322, 816.69721343479125}, - {59999.999999121159, 180.26975739282756, 816.72191756454924}, - {60000.00000036486, 180.48364565146377, 816.74663219124841}, - {59999.999999904954, 180.69753279192835, 816.7713572079532}, - {60000.000000054562, 181.0183614269956, 816.8084603269557}, - {59999.999999978463, 181.33918632988278, 816.84558675379014}, - {60000.000000049782, 181.44612751539663, 816.85796481705847}, - {59999.999999914071, 181.55306821881811, 816.87034546240886}, - {60000.000000125139, 181.66000840292782, 816.88272868833144}, - {59999.999999843392, 181.76694804030186, 816.89511449082431}, - {60000.000000167289, 181.87388708628473, 816.90750286566583}, - {59999.999999847467, 181.98082551962966, 816.9198938103757}, - {60000.000000119864, 182.08776329350809, 816.93228732197861}, - {59999.999999917491, 182.19470038386558, 816.94468339453306}, - {60000.000000050633, 182.30163675019068, 816.9570820285785}, - {59999.999999972366, 182.40857236133851, 816.96948321649302}, - {60000.000000032509, 182.56897459276843, 816.98808882907122}, - {59999.999999965934, 182.7293749693155, 817.00670017517837}, - {60000.000000238462, 182.78284155215263, 817.01290459816312}, - {59999.999999345615, 182.83630791626743, 817.01910964099045}, - {60000.00000119608, 182.88977407140584, 817.02531535916364}, - {59999.999998362182, 182.94323998619015, 817.03152164472851}, - {60000.000001757064, 182.99670569682132, 817.03772865736005}, - {59999.999998499035, 183.05017115047181, 817.04393620474377}, - {60000.00000101691, 183.10363639052409, 817.05014447471717}, - {59999.999999469313, 183.15710137432194, 817.05635331513508}, - {60000.000000196254, 183.21056612270786, 817.06256282498509}, - {59999.999999961823, 183.26403061846696, 817.06877295237007}, - {60000.000000031148, 183.37095910597188, 817.0811944807366}, - {59999.999999975873, 183.47788656385964, 817.09361853568328}, - {60000.000000078871, 183.53291535756762, 817.10001332133618}, - {59999.999999822408, 183.57465447580566, 817.10486251586156}, - {60000.000000306398, 183.67093862701302, 817.11605868308925}, - {59999.999999580868, 183.62493711493508, 817.11070057755603}, - {60000.000000457883, 183.83983154073323, 817.13569840343439}, - {59999.999999600586, 183.70298550843307, 817.11977179379392}, - {60000.000000274122, 183.92091406059222, 817.14512405357789}, - {59999.999999859414, 183.87191278066462, 817.13941945054194}, - {60000.000000045809, 183.96882854112027, 817.15069318206758}, - {59999.99999999682, 184.01172713386404, 817.15568252551441}, - {60000.000000002117, 199.05860625274244, 818.90605990894926}, - {60000.000000011685, 213.77441984052732, 820.66779572748067}, - {59999.999999945896, 228.63273752574398, 822.50191665906459}, - {60000.000000137385, 243.60930053773387, 824.4160390659564}, - {59999.999999745312, 257.44864608947171, 826.20557537898253}, - {60000.000000371336, 272.37732017567259, 828.28374145687258}, - {59999.999999564294, 283.4609507719199, 829.76911975631128}, - {60000.000000411754, 297.87730027160165, 831.94635758332913}, - {59999.999999691667, 308.39894455125989, 833.48120705572103}, - {60000.000000175751, 321.04689540263291, 835.47802201470222}, - {59999.999999930937, 332.7974681685576, 837.36295119087083}, - {60000.000000012922, 344.23852019267594, 839.26003269871717}, - {59999.999999978521, 380.87159046869039, 845.50264944092885}, - {60000.000000031927, 417.67053058140004, 852.32838657260925}, - {59999.999999895757, 443.71876268540638, 857.33613824789597}, - {60000.00000023668, 470.42282907220516, 863.40925211937144}, - {59999.999999591026, 506.36442771103123, 868.70489233101273}, - {60000.000000559063, 504.29569767668107, 873.82665736030435}, - {59999.999999387175, 618.22680165126303, 889.69085497467483}, - {60000.00000054048, 520.96760954336719, 878.60259543512541}, - {59999.999999620944, 695.15397128954748, 909.33199431749756}, - {60000.000000202854, 652.21259368585868, 902.32746593221361}, - {59999.999999925931, 713.31441817738153, 914.25671409207371}, - {60000.000000011525, 744.93626878652026, 920.45067498376648}, - {59999.999999986139, 851.85145355849977, 941.08553924856312}, - {60000.000000015752, 955.13474569084099, 960.32812261133847}, - {59999.99999996031, 1019.9477908992111, 972.25457694191095}, - {60000.000000078573, 1109.7424197388102, 989.27219905591903}, - {59999.999999866697, 1103.4472241364576, 986.24901738812696}, - {60000.000000196575, 1283.5502566789903, 1025.857653448167}, - {59999.999999756859, 1241.170752696316, 1010.5034788173898}, - {60000.000000241002, 1380.0598100152401, 1044.321387312001}, - {59999.999999814674, 1417.3346489504095, 1047.4285724180056}, - {60000.000000106025, 1498.5882349740116, 1064.7148393296281}, - {59999.999999959189, 1562.4075471540843, 1076.5692870450682}, - {60000.000000006847, 1632.0446827427525, 1089.9951747091934}, - {59999.999999992855, 1819.187180960379, 1125.8766969823027}, - {60000.000000006774, 2005.7867190244558, 1161.6893152514506}, - {59999.999999993102, 2127.1610378717864, 1184.8982806691761}, - {59999.999999983789, 2224.9504474907289, 1204.7794295042536}, - {60000.000000076092, 2423.4034586285211, 1239.2849934128672}, - {59999.999999843334, 2352.5108743508281, 1233.9178625300717}, - {60000.00000021555, 2789.1958451831979, 1304.7841887599538}, - {59999.999999781059, 2516.5832651666447, 1267.6317850640198}, - {60000.000000168911, 2997.8479508975411, 1347.2273537129538}, - {59999.999999901927, 2872.9560675152225, 1329.8998228537541}, - {60000.000000040534, 3100.1634765888271, 1371.640798220885}, - {59999.999999990199, 3186.6552406648925, 1389.3336814233451}, - {60000.000000019143, 3570.5318534479206, 1462.8626017289478}, - {59999.999999969914, 3906.3811637172125, 1522.697974792497}, - {60000.000000105116, 4081.0496155485694, 1554.1195061318422}, - {59999.999999764274, 4440.4680391955444, 1682.9362787226369}, - {60000.000000389882, 4025.4579062184348, 1482.6543564450828}, - {59999.999999500047, 5340.2058728577267, 2096.5041911809035}, - {60000.000000509819, 4233.9915572764976, 1518.9299243967394}, - {59999.999999583706, 5430.8345183928068, 2200.8401562891845}, - {60000.000000267981, 5054.5402162751188, 1969.4793692255021}, - {59999.999999871681, 5428.966058504895, 2244.2141001944756}, - {60000.000000038024, 5546.4649349764723, 2352.3606428637349}, - {59999.999999998952, 5706.4753141683368, 2517.0835536242184}, - {59999.999999991771, 6129.2268892602051, 3030.8327236291348}, - {60000.000000020089, 6420.3065439166912, 3661.6495160497966}, - {59999.99999990526, 6235.8646808219391, 3444.1541944672813}, - {60000.000000247288, 8126.8536394010316, 8890.661747328244}, - {59999.99999954299, 2104.925285609057, -7996.1134321147983}, - {60000.00000064441, 14264.475617875083, 34652.739991203249}, - {59999.999999283253, -1684.3290491164355, -33238.811620330394}, - {60000.000000641696, 13782.902589951687, 46532.286752882486}, - {59999.999999532913, 2699.6074087223524, -19079.410940396814}, - {60000.000000275439, 9084.6892111341349, 21937.827319607131}, - {59999.999999871587, 6474.8937324409353, 5006.3713661893671}, - {60000.000000044485, 7350.4434791870981, 10709.698171043074}, - {59999.999999990541, 7306.414330937022, 10560.108503883888}, - {60000, 7397.0783263606427, 11218.963217145942}}; - -const Standard_Integer Glob_NbKnots = 17; -const Standard_Real Glob_Knots[Glob_NbKnots] = {0, - 0.0087664292723375857, - 0.015654339342331427, - 0.019098294377328347, - 0.020820271894826808, - 0.021681260653576038, - 0.022111755032950653, - 0.022327002222637962, - 0.022434625817481617, - 0.022488437614903441, - 0.022542249412325268, - 0.037523693790797889, - 0.071526893170125505, - 0.1421299556831544, - 0.26514857375331263, - 0.51350664396810353, - 1}; - -const Standard_Integer Glob_Mults[Glob_NbKnots] = - {15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15}; - //================================================================================================= -static Standard_Integer OCC862(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 3) - { - di << "ERROR : Usage : " << argv[0] << " curve1 curve2\n"; - return 1; - } - - Standard_Integer i; - // Fill array of poles - TColgp_Array1OfPnt aPoles(1, Glob_NbPoles); - for (i = 0; i < Glob_NbPoles; i++) - aPoles.SetValue(i + 1, gp_Pnt(Glob_Poles[i][0], Glob_Poles[i][1], Glob_Poles[i][2])); - // Fill array of knots - TColStd_Array1OfReal aKnots(1, Glob_NbKnots); - for (i = 0; i < Glob_NbKnots; i++) - aKnots.SetValue(i + 1, Glob_Knots[i]); - // Fill array of mults - TColStd_Array1OfInteger aMults(1, Glob_NbKnots); - for (i = 0; i < Glob_NbKnots; i++) - aMults.SetValue(i + 1, Glob_Mults[i]); - // Create B-Spline curve - const Standard_Integer aDegree = 14; - Handle(Geom_BSplineCurve) C1 = new Geom_BSplineCurve(aPoles, aKnots, aMults, aDegree); - - // Create trimmed line - gp_XYZ p1(60000, -7504.83, 6000); - gp_XYZ p2(60000, 7504.83, 6000); - Handle(Geom_Line) L = new Geom_Line(gp_Pnt(p1), gp_Dir(p2 - p1)); - Handle(Geom_TrimmedCurve) C2 = new Geom_TrimmedCurve(L, 0.0, (p2 - p1).Modulus()); - - DrawTrSurf::Set(argv[1], C1); - DrawTrSurf::Set(argv[2], C2); - - // Try to find extrema - // IMPORTANT: it is not allowed to input infinite curves ! - GeomAPI_ExtremaCurveCurve Ex(C1, C2 /*,C1f,C1l,C2f,C2l*/); - if (Ex.Extrema().IsParallel()) - { - di << "Info: Infinite number of extrema, distance = " << Ex.LowerDistance() << "\n"; - } - else - { - // Check if extrema were found - const Standard_Integer nbEx = Ex.NbExtrema(); - if (nbEx) - { - // Get minimal distance data - gp_Pnt P1, P2; - Ex.NearestPoints(P1, P2); - Standard_Real U1, U2; - Ex.LowerDistanceParameters(U1, U2); - const Standard_Real D = Ex.LowerDistance(); - // IMPORTANT: minimal distance here means accuracy reached in intersection - di << "Info: Minimal distance is " << D << "\n"; - di << "Info: Minimal points are (" << P1.X() << "," << P1.Y() << "," << P1.Z() << "), (" - << P2.X() << "," << P2.Y() << "," << P2.Z() << ")\n"; - di << "Info: Minimal parameters are (" << U1 << "), (" << U2 << ")\n"; - } - else - { - di << "Error: extrema not found\n"; - } - } - - return 0; -} - void QABugs::Commands_7(Draw_Interpretor& theCommands) { const char* group = "QABugs"; - - theCommands.Add("OCC862", "OCC862 curve1 curve2", __FILE__, OCC862, group); - return; + (void)group; + (void)theCommands; } diff --git a/src/Draw/TKQADraw/QABugs/QABugs_9.cxx b/src/Draw/TKQADraw/QABugs/QABugs_9.cxx index 45cefb35ad..e3b87ac776 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_9.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_9.cxx @@ -71,80 +71,11 @@ static Standard_Integer BUC60857(Draw_Interpretor& di, Standard_Integer /*argc*/ #include #include -static Standard_Integer OCC24303(Draw_Interpretor& di, Standard_Integer n, const char** a) -{ - if (n < 2) - return 1; - - const Standard_Integer SolID = Draw::Atoi(a[1]); - - // Ellipses - Standard_Real majorRadius = 2.0; - Standard_Real minorRadius = 1.0; - gp_Pnt2d p0(gp::Origin2d()); - gp_Pnt2d p1(4.0, 0.0); - - gp_Elips2d ellipse1 = gp_Elips2d(gp_Ax2d(p0, gp::DX2d()), majorRadius, minorRadius, true); - gp_Elips2d ellipse2 = gp_Elips2d(gp_Ax2d(p1, gp::DX2d()), majorRadius, minorRadius, true); - - Handle(Geom2d_Curve) curve1 = new Geom2d_Ellipse(ellipse1); - Handle(Geom2d_Curve) curve2 = new Geom2d_Ellipse(ellipse2); - DrawTrSurf::Set("c1", curve1); - DrawTrSurf::Set("c2", curve2); - // Expected tangent - gp_Pnt2d centre(5.0, 0.0); - Standard_Real radius = 3.0; - gp_Circ2d theorical_tangent = gp_Circ2d(gp_Ax2d(centre, gp::DX2d()), radius); - - // Calculate the tangent with Geom2dGcc_Circ2dTanRan - - const Geom2dAdaptor_Curve AdaptedCurve1(curve1); - const Geom2dAdaptor_Curve AdaptedCurve2(curve2); - - GccEnt_Position curveQualif1 = GccEnt_unqualified; - GccEnt_Position curveQualif2 = GccEnt_unqualified; - - const Geom2dGcc_QualifiedCurve qualifiedCurve1(AdaptedCurve1, curveQualif1); - const Geom2dGcc_QualifiedCurve qualifiedCurve2(AdaptedCurve2, curveQualif2); - - const Geom2dGcc_Circ2d2TanRad circCalc(qualifiedCurve1, - qualifiedCurve2, - radius, - /*Precision::Approximation()*/ 1.0e-9); - - const Standard_Integer aNbSol = circCalc.NbSolutions(); - di << "Solutions " << aNbSol << "\n"; - - if ((SolID < 1) || (SolID > aNbSol)) - { - di << "Wrong SolID value\n"; - return 1; - } - - gp_Circ2d calculated_tangent = circCalc.ThisSolution(SolID); - - char Buf[10]; - for (Standard_Integer i = 1; i <= aNbSol; i++) - { - gp_Circ2d ct = circCalc.ThisSolution(i); - Handle(Geom2d_Circle) GSol = new Geom2d_Circle(ct); - Sprintf(Buf, "Sol%d", i); - DrawTrSurf::Set(Buf, GSol); - } - - // This distance is different in OC 6.5.4 and OC 6.6.0 - Standard_Real dist = theorical_tangent.Location().Distance(calculated_tangent.Location()); - di << "Distance = " << dist << "\n"; - - return 0; -} - void QABugs::Commands_9(Draw_Interpretor& theCommands) { const char* group = "QABugs"; theCommands.Add("BUC60857", "BUC60857", __FILE__, BUC60857, group); - theCommands.Add("OCC24303", "OCC24303 SolID ", __FILE__, OCC24303, group); return; } diff --git a/src/FoundationClasses/TKMath/GTests/Bnd_BoundSortBox_Test.cxx b/src/FoundationClasses/TKMath/GTests/Bnd_BoundSortBox_Test.cxx index e39981e58c..7e8fdbb24c 100644 --- a/src/FoundationClasses/TKMath/GTests/Bnd_BoundSortBox_Test.cxx +++ b/src/FoundationClasses/TKMath/GTests/Bnd_BoundSortBox_Test.cxx @@ -16,10 +16,14 @@ #include #include #include +#include +#include #include #include #include #include +#include +#include #include #include @@ -277,3 +281,41 @@ TEST_F(Bnd_BoundSortBoxTest, DegenerateBoxes) EXPECT_EQ(1, pointResult.Extent()) << "Expected to find only the point box"; EXPECT_EQ(1, pointResult.First()) << "Point box (index 1) should be the only result"; } + +//================================================================================================== + +// Test BUC60729: Initialize Bnd_BoundSortBox with face boxes from a solid +// Migrated from QABugs_3.cxx +TEST(Bnd_BoundSortBox_Test, BUC60729_InitializeWithFaceBoxes) +{ + // Create a simple box solid + TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1.0, 1.0, 1.0).Solid(); + + // Create main bounding box for the shape + Bnd_Box aMainBox; + BRepBndLib::Add(aShape, aMainBox); + + // Initialize BoundSortBox with 6 boxes (for 6 faces of the cube) + const Standard_Integer aMaxNbrBox = 6; + Bnd_BoundSortBox aBoundSortBox; + aBoundSortBox.Initialize(aMainBox, aMaxNbrBox); + + // Iterate through faces and add their bounding boxes + TopExp_Explorer aExplorer(aShape, TopAbs_FACE); + Standard_Integer i; + + for (i = 1, aExplorer.ReInit(); aExplorer.More(); aExplorer.Next(), i++) + { + const TopoDS_Shape& aFace = aExplorer.Current(); + Bnd_Box aBox; + BRepBndLib::Add(aFace, aBox); + aBoundSortBox.Add(aBox, i); + } + + // Verify that 6 faces were processed + EXPECT_EQ(7, i) << "Expected to process 6 faces (i should be 7 after loop)"; + + // The test passes if no exceptions occurred during initialization and addition + // This test originally verified that the Bnd_BoundSortBox could handle + // initialization and addition of multiple boxes without crashing +} diff --git a/src/FoundationClasses/TKMath/GTests/Bnd_Box_Test.cxx b/src/FoundationClasses/TKMath/GTests/Bnd_Box_Test.cxx index 5be9ca4c45..3cec183244 100644 --- a/src/FoundationClasses/TKMath/GTests/Bnd_Box_Test.cxx +++ b/src/FoundationClasses/TKMath/GTests/Bnd_Box_Test.cxx @@ -812,4 +812,37 @@ TEST(Bnd_BoxTest, DumpJsonAndInitFromJson) EXPECT_DOUBLE_EQ(aZmax1, aZmax2) << "Deserialized box should match original"; EXPECT_DOUBLE_EQ(aBox.GetGap(), aDeserializedBox.GetGap()) << "Deserialized gap should match original"; +} + +//================================================================================================== +// Regression Tests +//================================================================================================== + +// Test OCC16485: Bnd_Box tolerance issue with cumulative enlargement +// Migrated from QABugs_14.cxx +TEST(Bnd_BoxTest, OCC16485_CumulativeEnlargeTolerance) +{ + // Create points with X coordinate varying from 0 to 1000 + // and compute cumulative bounding box by adding boxes for all the + // points, enlarged on tolerance + const Standard_Real aTol = 1e-3; + const Standard_Integer aNbStep = 1000; + Bnd_Box aBox; + + for (Standard_Integer i = 0; i <= aNbStep; i++) + { + gp_Pnt aP(i, 0., 0.); + Bnd_Box aB; + aB.Add(aP); + aB.Enlarge(aTol); + aB.Add(aBox); + aBox = aB; // This was causing XMin to grow each time (regression) + } + + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + + // Verify that Xmin is approximately -tolerance (not growing with iterations) + EXPECT_NEAR(-aTol, aXmin, 1e-10) << "Xmin should be equal to -tolerance"; + EXPECT_NEAR(aNbStep + aTol, aXmax, 1e-10) << "Xmax should be equal to nbstep + tolerance"; } \ No newline at end of file diff --git a/src/FoundationClasses/TKMath/GTests/Bnd_OBB_Test.cxx b/src/FoundationClasses/TKMath/GTests/Bnd_OBB_Test.cxx new file mode 100644 index 0000000000..773f129801 --- /dev/null +++ b/src/FoundationClasses/TKMath/GTests/Bnd_OBB_Test.cxx @@ -0,0 +1,33 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include + +#include + +TEST(Bnd_OBB_Test, OCC33009_ReBuildWithPoints) +{ + Bnd_OBB aBndBox; + + TColgp_Array1OfPnt aPoints(1, 5); + aPoints.ChangeValue(1) = gp_Pnt(1, 2, 3); + aPoints.ChangeValue(2) = gp_Pnt(3, 2, 1); + aPoints.ChangeValue(3) = gp_Pnt(2, 3, 1); + aPoints.ChangeValue(4) = gp_Pnt(1, 3, 2); + aPoints.ChangeValue(5) = gp_Pnt(2, 1, 3); + + // Should not throw exception when rebuilding with points + EXPECT_NO_THROW(aBndBox.ReBuild(aPoints, (const TColStd_Array1OfReal*)0, true)); +} diff --git a/src/FoundationClasses/TKMath/GTests/FILES.cmake b/src/FoundationClasses/TKMath/GTests/FILES.cmake index 6e699ed55c..742b4517ff 100644 --- a/src/FoundationClasses/TKMath/GTests/FILES.cmake +++ b/src/FoundationClasses/TKMath/GTests/FILES.cmake @@ -4,13 +4,18 @@ set(OCCT_TKMath_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKMath_GTests_FILES Bnd_BoundSortBox_Test.cxx Bnd_Box_Test.cxx + Bnd_OBB_Test.cxx ElCLib_Test.cxx + gp_Ax3_Test.cxx + gp_Mat_Test.cxx + gp_Trsf_Test.cxx math_BFGS_Test.cxx math_BissecNewton_Test.cxx math_BracketMinimum_Test.cxx math_BracketedRoot_Test.cxx math_Crout_Test.cxx math_BrentMinimum_Test.cxx + math_ComputeKronrodPointsAndWeights_Test.cxx math_DirectPolynomialRoots_Test.cxx math_DoubleTab_Test.cxx math_EigenValuesSearcher_Test.cxx diff --git a/src/FoundationClasses/TKMath/GTests/gp_Ax3_Test.cxx b/src/FoundationClasses/TKMath/GTests/gp_Ax3_Test.cxx new file mode 100644 index 0000000000..c711c65330 --- /dev/null +++ b/src/FoundationClasses/TKMath/GTests/gp_Ax3_Test.cxx @@ -0,0 +1,130 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include + +#include + +TEST(gp_Ax3_Test, OCC29406_SetDirectionPreservesOrientation) +{ + // Test Main (Z) direction + { + // gp_Ax3::SetDirection() test + gp_Ax3 anAx1, anAx2, anAx3, anAx4; + anAx3.ZReverse(); + anAx4.ZReverse(); + + Standard_Boolean bDirect1 = anAx1.Direct(); + anAx1.SetDirection(gp::DX()); + EXPECT_EQ(bDirect1, anAx1.Direct()) << "Coordinate system orientation should be preserved"; + EXPECT_TRUE(gp::DX().IsEqual(anAx1.Direction(), Precision::Angular())); + + Standard_Boolean bDirect2 = anAx2.Direct(); + anAx2.SetDirection(-gp::DX()); + EXPECT_EQ(bDirect2, anAx2.Direct()); + EXPECT_TRUE((-gp::DX()).IsEqual(anAx2.Direction(), Precision::Angular())); + + Standard_Boolean bDirect3 = anAx3.Direct(); + anAx3.SetDirection(gp::DX()); + EXPECT_EQ(bDirect3, anAx3.Direct()); + EXPECT_TRUE(gp::DX().IsEqual(anAx3.Direction(), Precision::Angular())); + + Standard_Boolean bDirect4 = anAx4.Direct(); + anAx4.SetDirection(-gp::DX()); + EXPECT_EQ(bDirect4, anAx4.Direct()); + EXPECT_TRUE((-gp::DX()).IsEqual(anAx4.Direction(), Precision::Angular())); + + // gp_Ax3::SetAxis() test + gp_Ax3 anAx5, anAx6; + gp_Ax1 anAx0_1(gp::Origin(), gp::DX()); + gp_Ax1 anAx0_2(gp::Origin(), -gp::DX()); + + Standard_Boolean bDirect5 = anAx5.Direct(); + anAx5.SetAxis(anAx0_1); + EXPECT_EQ(bDirect5, anAx5.Direct()); + EXPECT_TRUE(anAx0_1.Direction().IsEqual(anAx5.Direction(), Precision::Angular())); + + Standard_Boolean bDirect6 = anAx6.Direct(); + anAx6.SetAxis(anAx0_2); + EXPECT_EQ(bDirect6, anAx6.Direct()); + EXPECT_TRUE(anAx0_2.Direction().IsEqual(anAx6.Direction(), Precision::Angular())); + } + + // Test X direction + { + gp_Ax3 anAx1, anAx2, anAx3, anAx4; + anAx3.XReverse(); + anAx4.XReverse(); + + Standard_Boolean bDirect1 = anAx1.Direct(); + anAx1.SetXDirection(gp::DZ()); + EXPECT_EQ(bDirect1, anAx1.Direct()); + gp_Dir aGoodY1 = anAx1.Direction().Crossed(gp::DZ()); + if (anAx1.Direct()) + { + EXPECT_TRUE(aGoodY1.IsEqual(anAx1.YDirection(), Precision::Angular())); + } + else + { + EXPECT_TRUE(aGoodY1.IsOpposite(anAx1.YDirection(), Precision::Angular())); + } + + Standard_Boolean bDirect2 = anAx2.Direct(); + anAx2.SetXDirection(-gp::DZ()); + EXPECT_EQ(bDirect2, anAx2.Direct()); + + Standard_Boolean bDirect3 = anAx3.Direct(); + anAx3.SetXDirection(gp::DZ()); + EXPECT_EQ(bDirect3, anAx3.Direct()); + + Standard_Boolean bDirect4 = anAx4.Direct(); + anAx4.SetXDirection(-gp::DZ()); + EXPECT_EQ(bDirect4, anAx4.Direct()); + } + + // Test Y direction + { + gp_Ax3 anAx1, anAx2, anAx3, anAx4; + anAx3.YReverse(); + anAx4.YReverse(); + + Standard_Boolean bDirect1 = anAx1.Direct(); + anAx1.SetYDirection(gp::DZ()); + EXPECT_EQ(bDirect1, anAx1.Direct()); + gp_Dir aGoodX1 = anAx1.Direction().Crossed(gp::DZ()); + if (anAx1.Direct()) + { + EXPECT_TRUE(aGoodX1.IsOpposite(anAx1.XDirection(), Precision::Angular())); + } + else + { + EXPECT_TRUE(aGoodX1.IsEqual(anAx1.XDirection(), Precision::Angular())); + } + + Standard_Boolean bDirect2 = anAx2.Direct(); + anAx2.SetYDirection(-gp::DZ()); + EXPECT_EQ(bDirect2, anAx2.Direct()); + + Standard_Boolean bDirect3 = anAx3.Direct(); + anAx3.SetYDirection(gp::DZ()); + EXPECT_EQ(bDirect3, anAx3.Direct()); + + Standard_Boolean bDirect4 = anAx4.Direct(); + anAx4.SetYDirection(-gp::DZ()); + EXPECT_EQ(bDirect4, anAx4.Direct()); + } +} diff --git a/src/FoundationClasses/TKMath/GTests/gp_Mat_Test.cxx b/src/FoundationClasses/TKMath/GTests/gp_Mat_Test.cxx new file mode 100644 index 0000000000..d11a26a771 --- /dev/null +++ b/src/FoundationClasses/TKMath/GTests/gp_Mat_Test.cxx @@ -0,0 +1,35 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +TEST(gp_MatTest, OCC22595_DefaultConstructor) +{ + gp_Mat aM0; + + // Bug OCC22595: gp_Mat's constructors incompletely initialize memory + // Test that default constructor properly initializes all matrix elements to zero + EXPECT_DOUBLE_EQ(0.0, aM0(1, 1)); + EXPECT_DOUBLE_EQ(0.0, aM0(1, 2)); + EXPECT_DOUBLE_EQ(0.0, aM0(1, 3)); + + EXPECT_DOUBLE_EQ(0.0, aM0(2, 1)); + EXPECT_DOUBLE_EQ(0.0, aM0(2, 2)); + EXPECT_DOUBLE_EQ(0.0, aM0(2, 3)); + + EXPECT_DOUBLE_EQ(0.0, aM0(3, 1)); + EXPECT_DOUBLE_EQ(0.0, aM0(3, 2)); + EXPECT_DOUBLE_EQ(0.0, aM0(3, 3)); +} diff --git a/src/FoundationClasses/TKMath/GTests/gp_Trsf_Test.cxx b/src/FoundationClasses/TKMath/GTests/gp_Trsf_Test.cxx new file mode 100644 index 0000000000..d82efb6bcf --- /dev/null +++ b/src/FoundationClasses/TKMath/GTests/gp_Trsf_Test.cxx @@ -0,0 +1,39 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include + +#include + +TEST(gp_TrsfTest, OCC23361_TransformationComposition) +{ + gp_Pnt aP(0, 0, 2); + + gp_Trsf aT1, aT2; + aT1.SetRotation(gp_Ax1(aP, gp_Dir(gp_Dir::D::Y)), -0.49328285294022267); + aT2.SetRotation(gp_Ax1(aP, gp_Dir(gp_Dir::D::Z)), 0.87538474718473880); + + gp_Trsf aTComp = aT2 * aT1; + + gp_Pnt aP1(10, 3, 4); + gp_Pnt aP2 = aP1.Transformed(aTComp); + gp_Pnt aP3 = aP1.Transformed(aT1); + aP3.Transform(aT2); + + // Points must be equal: equivalent transformations should produce equal points + EXPECT_TRUE(aP2.IsEqual(aP3, Precision::Confusion())); +} diff --git a/src/FoundationClasses/TKMath/GTests/math_ComputeKronrodPointsAndWeights_Test.cxx b/src/FoundationClasses/TKMath/GTests/math_ComputeKronrodPointsAndWeights_Test.cxx new file mode 100644 index 0000000000..6617f02273 --- /dev/null +++ b/src/FoundationClasses/TKMath/GTests/math_ComputeKronrodPointsAndWeights_Test.cxx @@ -0,0 +1,36 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +TEST(math_ComputeKronrodPointsAndWeights_Test, OCC33048_ComputeWithOrder125) +{ + // This method uses raw pointers for memory manipulations + // Test that it completes successfully without crashes + Standard_Boolean isOK = Standard_True; + try + { + math_ComputeKronrodPointsAndWeights aCalc(125); + EXPECT_TRUE(aCalc.IsDone()) << "Kronrod points and weights calculation should succeed"; + isOK = aCalc.IsDone(); + } + catch (...) + { + FAIL() << "Exception occurred during calculation of Kronrod points and weights"; + isOK = Standard_False; + } + + EXPECT_TRUE(isOK); +} diff --git a/src/FoundationClasses/TKernel/GTests/FILES.cmake b/src/FoundationClasses/TKernel/GTests/FILES.cmake index 31c64215de..77a983dc8e 100644 --- a/src/FoundationClasses/TKernel/GTests/FILES.cmake +++ b/src/FoundationClasses/TKernel/GTests/FILES.cmake @@ -22,7 +22,11 @@ set(OCCT_TKernel_GTests_FILES OSD_Path_Test.cxx OSD_PerfMeter_Test.cxx Standard_ArrayStreamBuffer_Test.cxx + Standard_Atomic_Test.cxx + Standard_Character_Test.cxx Standard_Dump_Test.cxx + Standard_Handle_Test.cxx TCollection_AsciiString_Test.cxx TCollection_ExtendedString_Test.cxx + UnitsAPI_Test.cxx ) diff --git a/src/FoundationClasses/TKernel/GTests/NCollection_Map_Test.cxx b/src/FoundationClasses/TKernel/GTests/NCollection_Map_Test.cxx index 9b3529eb86..ffb2226ab9 100644 --- a/src/FoundationClasses/TKernel/GTests/NCollection_Map_Test.cxx +++ b/src/FoundationClasses/TKernel/GTests/NCollection_Map_Test.cxx @@ -12,6 +12,7 @@ // commercial license or contractual agreement. #include +#include #include #include @@ -215,4 +216,81 @@ TEST(NCollection_MapTest, ExhaustiveIterator) // Calculate expected sum: 0 + 1 + 2 + ... + (NUM_ELEMENTS-1) int expectedSum = (NUM_ELEMENTS * (NUM_ELEMENTS - 1)) / 2; EXPECT_EQ(expectedSum, sum); -} \ No newline at end of file +} + +TEST(NCollection_MapTest, OCC24271_BooleanOperations) +{ + const Standard_Integer aLeftLower = 1; + const Standard_Integer aLeftUpper = 10; + const Standard_Integer aRightLower = 5; + const Standard_Integer aRightUpper = 15; + + NCollection_Map aMapLeft; + for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aLeftUpper; ++aKeyIter) + { + aMapLeft.Add(aKeyIter); + } + + NCollection_Map aMapRight; + for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aRightUpper; ++aKeyIter) + { + aMapRight.Add(aKeyIter); + } + + EXPECT_FALSE(NCollection_MapAlgo::Contains(aMapLeft, aMapRight)); + EXPECT_FALSE(NCollection_MapAlgo::Contains(aMapRight, aMapLeft)); + + NCollection_Map aMapUnion; + NCollection_MapAlgo::Union(aMapUnion, aMapLeft, aMapRight); + EXPECT_EQ(aRightUpper - aLeftLower + 1, aMapUnion.Extent()); + for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aRightUpper; ++aKeyIter) + { + EXPECT_TRUE(aMapUnion.Contains(aKeyIter)); + } + + NCollection_Map aMapSect; + NCollection_MapAlgo::Intersection(aMapSect, aMapLeft, aMapRight); + EXPECT_EQ(aLeftUpper - aRightLower + 1, aMapSect.Extent()); + for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter) + { + EXPECT_TRUE(aMapSect.Contains(aKeyIter)); + } + EXPECT_TRUE(NCollection_MapAlgo::Contains(aMapLeft, aMapSect)); + EXPECT_TRUE(NCollection_MapAlgo::Contains(aMapRight, aMapSect)); + + NCollection_Map aMapSubsLR; + NCollection_MapAlgo::Subtraction(aMapSubsLR, aMapLeft, aMapRight); + EXPECT_EQ(aRightLower - aLeftLower, aMapSubsLR.Extent()); + for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter) + { + EXPECT_TRUE(aMapSubsLR.Contains(aKeyIter)); + } + + NCollection_Map aMapSubsRL; + NCollection_MapAlgo::Subtraction(aMapSubsRL, aMapRight, aMapLeft); + EXPECT_EQ(aRightUpper - aLeftUpper, aMapSubsRL.Extent()); + for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter <= aRightUpper; ++aKeyIter) + { + EXPECT_TRUE(aMapSubsRL.Contains(aKeyIter)); + } + + NCollection_Map aMapDiff; + NCollection_MapAlgo::Difference(aMapDiff, aMapLeft, aMapRight); + EXPECT_EQ(aRightLower - aLeftLower + aRightUpper - aLeftUpper, aMapDiff.Extent()); + for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter) + { + EXPECT_TRUE(aMapDiff.Contains(aKeyIter)); + } + for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter <= aRightUpper; ++aKeyIter) + { + EXPECT_TRUE(aMapDiff.Contains(aKeyIter)); + } + + NCollection_Map aMapSwap; + aMapSwap.Exchange(aMapSect); + for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter) + { + EXPECT_TRUE(aMapSwap.Contains(aKeyIter)); + } + EXPECT_TRUE(aMapSect.IsEmpty()); +} diff --git a/src/FoundationClasses/TKernel/GTests/OSD_Path_Test.cxx b/src/FoundationClasses/TKernel/GTests/OSD_Path_Test.cxx index 51c76c5308..718881b693 100644 --- a/src/FoundationClasses/TKernel/GTests/OSD_Path_Test.cxx +++ b/src/FoundationClasses/TKernel/GTests/OSD_Path_Test.cxx @@ -12,6 +12,7 @@ // commercial license or contractual agreement. #include +#include #include #include @@ -243,4 +244,38 @@ TEST_F(OSD_PathTest, MixedSeparators) OSD_Path::FolderAndFileFromPath("C:/Users/John\\Documents/file.txt", aFolder, aFileName); // The exact behavior might depend on implementation, but it should handle this gracefully EXPECT_FALSE(aFolder.IsEmpty() || aFileName.IsEmpty()); -} \ No newline at end of file +} + +TEST_F(OSD_PathTest, OCC310_TrekAndUpTrek) +{ + OSD_Path aPath("/where/you/want/tmp/qwerty/tmp/"); + TCollection_AsciiString aTrek = aPath.Trek(); + + // OSD_Path uses | as the internal portable trek separator on all platforms + EXPECT_STREQ("|where|you|want|tmp|qwerty|tmp|", aTrek.ToCString()); + + aPath.UpTrek(); + aTrek = aPath.Trek(); + + EXPECT_STREQ("|where|you|want|tmp|qwerty|", aTrek.ToCString()); +} + +TEST_F(OSD_PathTest, OCC309_CurrentDirectoryAndUpTrek) +{ + OSD_Process aProcess; + OSD_Path aPath = aProcess.CurrentDirectory(); + TCollection_AsciiString aSystemName1; + aPath.SystemName(aSystemName1); + EXPECT_FALSE(aSystemName1.IsEmpty()); + + aPath.UpTrek(); + TCollection_AsciiString aSystemName2; + aPath.SystemName(aSystemName2); + EXPECT_FALSE(aSystemName2.IsEmpty()); + EXPECT_NE(aSystemName1, aSystemName2); + EXPECT_LT(aSystemName2.Length(), aSystemName1.Length()); +} + +//================================================================================================== +// Validation Tests +//================================================================================================== \ No newline at end of file diff --git a/src/FoundationClasses/TKernel/GTests/Standard_Atomic_Test.cxx b/src/FoundationClasses/TKernel/GTests/Standard_Atomic_Test.cxx new file mode 100644 index 0000000000..7061ff2217 --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/Standard_Atomic_Test.cxx @@ -0,0 +1,66 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +#include +#include + +namespace +{ +class IncrementerDecrementer +{ +public: + IncrementerDecrementer(std::atomic* theVal, Standard_Boolean thePositive) + : myVal(theVal), + myPositive(thePositive) + { + } + + void operator()(const size_t) const + { + if (myPositive) + ++(*myVal); + else + --(*myVal); + } + +private: + std::atomic* myVal; + Standard_Boolean myPositive; +}; +} // namespace + +TEST(Standard_AtomicTest, OCC22980_AtomicOperations) +{ + std::atomic aSum(0); + + // Check returned value + EXPECT_EQ(-1, aSum.fetch_sub(1) - 1); + EXPECT_EQ(0, aSum.fetch_add(1) + 1); + EXPECT_EQ(1, aSum.fetch_add(1) + 1); + EXPECT_EQ(2, aSum.fetch_add(1) + 1); + + // Check atomicity + aSum = 0; + const int N = 1 << 24; // big enough to ensure concurrency + + // Increment + OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, Standard_True)); + EXPECT_EQ(N, aSum); + + // Decrement + OSD_Parallel::For(0, N, IncrementerDecrementer(&aSum, Standard_False)); + EXPECT_EQ(0, aSum); +} diff --git a/src/FoundationClasses/TKernel/GTests/Standard_Character_Test.cxx b/src/FoundationClasses/TKernel/GTests/Standard_Character_Test.cxx new file mode 100644 index 0000000000..ae9ee5fc4a --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/Standard_Character_Test.cxx @@ -0,0 +1,63 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +TEST(Standard_Character_Test, OCC29925_CharacterClassificationFunctions) +{ + // Test that all character classification functions work without crashes + // for all valid ASCII chars (including extended) + for (int i = 0; i < 256; i++) + { + Standard_Character c = (char)(unsigned char)i; + + // These functions should not throw exceptions for any valid ASCII character + EXPECT_NO_THROW(IsAlphabetic(c)); + EXPECT_NO_THROW(IsDigit(c)); + EXPECT_NO_THROW(IsXDigit(c)); + EXPECT_NO_THROW(IsAlphanumeric(c)); + EXPECT_NO_THROW(IsControl(c)); + EXPECT_NO_THROW(IsGraphic(c)); + EXPECT_NO_THROW(IsLowerCase(c)); + EXPECT_NO_THROW(IsPrintable(c)); + EXPECT_NO_THROW(IsPunctuation(c)); + EXPECT_NO_THROW(IsSpace(c)); + EXPECT_NO_THROW(IsUpperCase(c)); + EXPECT_NO_THROW(LowerCase(c)); + EXPECT_NO_THROW(UpperCase(c)); + } + + // Verify some specific character classifications + EXPECT_TRUE(IsAlphabetic('A')); + EXPECT_TRUE(IsAlphabetic('z')); + EXPECT_FALSE(IsAlphabetic('5')); + + EXPECT_TRUE(IsDigit('0')); + EXPECT_TRUE(IsDigit('9')); + EXPECT_FALSE(IsDigit('A')); + + EXPECT_TRUE(IsSpace(' ')); + EXPECT_TRUE(IsSpace('\t')); + EXPECT_FALSE(IsSpace('A')); + + EXPECT_TRUE(IsLowerCase('a')); + EXPECT_FALSE(IsLowerCase('A')); + + EXPECT_TRUE(IsUpperCase('A')); + EXPECT_FALSE(IsUpperCase('a')); + + EXPECT_EQ('a', LowerCase('A')); + EXPECT_EQ('A', UpperCase('a')); +} diff --git a/src/FoundationClasses/TKernel/GTests/Standard_Handle_Test.cxx b/src/FoundationClasses/TKernel/GTests/Standard_Handle_Test.cxx new file mode 100644 index 0000000000..9c07a7c7a7 --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/Standard_Handle_Test.cxx @@ -0,0 +1,41 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +#include + +TEST(Standard_Handle_Test, OCC24533_IsNullAndPointerChecks) +{ + Handle(Standard_Transient) aHandle; + + // Test IsNull() for default-constructed handle + EXPECT_TRUE(aHandle.IsNull()); + + // Test pointer access for null handle + const Standard_Transient* p = aHandle.get(); + EXPECT_FALSE(static_cast(p)); + EXPECT_EQ(nullptr, p); + + // Create non-null handle + aHandle = new Standard_Transient(); + + // Test IsNull() for non-null handle + EXPECT_FALSE(aHandle.IsNull()); + + // Test pointer access for non-null handle + p = aHandle.get(); + EXPECT_TRUE(static_cast(p)); + EXPECT_NE(nullptr, p); +} diff --git a/src/FoundationClasses/TKernel/GTests/TCollection_AsciiString_Test.cxx b/src/FoundationClasses/TKernel/GTests/TCollection_AsciiString_Test.cxx index 64715e1257..7a7782d604 100644 --- a/src/FoundationClasses/TKernel/GTests/TCollection_AsciiString_Test.cxx +++ b/src/FoundationClasses/TKernel/GTests/TCollection_AsciiString_Test.cxx @@ -13,6 +13,7 @@ #include #include +#include #include @@ -1414,3 +1415,158 @@ TEST(TCollection_AsciiStringTest, AssignCat_MultipleInLoop) EXPECT_TRUE(strstr(aResult, "1:On") != nullptr); EXPECT_TRUE(strstr(aResult, "alpha:") != nullptr); } + +// Test BUC60724: Empty string initialization +// Migrated from QABugs_3.cxx +TEST(TCollection_AsciiStringTest, BUC60724_EmptyStringInitialization) +{ + // Test empty string initialization with empty C string + TCollection_AsciiString aString1(""); + EXPECT_NE(nullptr, aString1.ToCString()); + EXPECT_EQ(0, aString1.Length()); + EXPECT_EQ('\0', aString1.ToCString()[0]); + + // Test empty string initialization with null character + TCollection_AsciiString aString2('\0'); + EXPECT_NE(nullptr, aString2.ToCString()); + EXPECT_EQ(0, aString2.Length()); + EXPECT_EQ('\0', aString2.ToCString()[0]); +} + +// Test BUC60773: TCollection_HAsciiString initialization +// Migrated from QABugs_3.cxx +TEST(TCollection_AsciiStringTest, BUC60773_HAsciiStringInitialization) +{ + // Create empty HAsciiString + Handle(TCollection_HAsciiString) anHAscii = new TCollection_HAsciiString(); + EXPECT_FALSE(anHAscii.IsNull()); + + // Get C string from HAsciiString + Standard_CString aStr = anHAscii->ToCString(); + EXPECT_NE(nullptr, aStr); + + // Create AsciiString from C string + TCollection_AsciiString aAscii(aStr); + EXPECT_EQ(0, aAscii.Length()); + EXPECT_TRUE(aAscii.IsEmpty()); +} + +// Test OCC6794: TCollection_AsciiString large concatenation +// Migrated from QABugs_14.cxx +TEST(TCollection_AsciiStringTest, OCC6794_LargeConcatenation) +{ + // Test concatenation of many small strings to verify memory handling + const Standard_Integer aNb = 10000; // Use a smaller number for faster test + const char* aC = "a"; + + TCollection_AsciiString anAscii; + for (Standard_Integer i = 1; i <= aNb; i++) + { + anAscii += TCollection_AsciiString(aC); + } + + // Verify the final length matches expected + EXPECT_EQ(aNb, anAscii.Length()) << "Concatenated string should have correct length"; + EXPECT_FALSE(anAscii.IsEmpty()) << "Concatenated string should not be empty"; +} + +TEST(TCollection_AsciiStringTest, OCC11758_ComprehensiveConstructorsAndMethods) +{ + const char* theStr = "0123456789"; + + for (Standard_Integer i = 0; i < 5; ++i) + { + // TCollection_AsciiString(const Standard_CString astring) + TCollection_AsciiString a(theStr + i); + EXPECT_STREQ(theStr + i, a.ToCString()); + + // TCollection_AsciiString(const Standard_CString astring, const Standard_Integer aLen) + TCollection_AsciiString b(theStr + i, 3); + EXPECT_EQ(3, b.Length()); + EXPECT_EQ(0, strncmp(b.ToCString(), theStr + i, 3)); + + // TCollection_AsciiString(const Standard_Integer aValue) + TCollection_AsciiString c(i); + EXPECT_TRUE(c.IsIntegerValue()); + EXPECT_EQ(i, c.IntegerValue()); + + // TCollection_AsciiString(const Standard_Real aValue) + TCollection_AsciiString d(0.1 * i); + EXPECT_TRUE(d.IsRealValue(Standard_True)); + EXPECT_FALSE(TCollection_AsciiString("3.3!").IsRealValue(Standard_True)); + EXPECT_TRUE(TCollection_AsciiString("3.3!").IsRealValue(Standard_False)); + EXPECT_STREQ("3.3", TCollection_AsciiString(3.3).ToCString()); + + // Copy constructor + TCollection_AsciiString e(d); + EXPECT_STREQ(d.ToCString(), e.ToCString()); + EXPECT_EQ(d.Length(), e.Length()); + + // Concatenation with char + TCollection_AsciiString f(e, '\a'); + EXPECT_EQ(e.Length() + 1, f.Length()); + EXPECT_EQ(0, strncmp(f.ToCString(), e.ToCString(), e.Length())); + EXPECT_EQ('\a', f.Value(f.Length())); + + // Concatenation with C string + TCollection_AsciiString g(f, theStr); + EXPECT_EQ(f.Length() + (Standard_Integer)strlen(theStr), g.Length()); + EXPECT_EQ(0, strncmp(g.ToCString(), f.ToCString(), f.Length())); + EXPECT_EQ(f.Length() + 1, g.Search(theStr)); + + // Concatenation with TCollection_AsciiString + TCollection_AsciiString h(d, a); + EXPECT_EQ(d.Length() + a.Length(), h.Length()); + EXPECT_EQ(0, strncmp(h.ToCString(), d.ToCString(), d.Length())); + EXPECT_EQ(0, strncmp(h.ToCString() + d.Length(), a.ToCString(), a.Length())); + + // AssignCat with C string + c.AssignCat(a.ToCString()); + EXPECT_EQ(1 + a.Length(), c.Length()); + EXPECT_EQ(2, c.Search(a)); + + // AssignCat with TCollection_AsciiString + Standard_Integer dl = d.Length(); + d.AssignCat(a); + EXPECT_EQ(dl + a.Length(), d.Length()); + EXPECT_EQ(dl + 1, d.Search(a)); + + // Capitalize + TCollection_AsciiString capitalize("aBC"); + capitalize.Capitalize(); + EXPECT_STREQ("Abc", capitalize.ToCString()); + + // Copy assignment + d = theStr + i; + EXPECT_STREQ(theStr + i, d.ToCString()); + + d = h; + EXPECT_STREQ(h.ToCString(), d.ToCString()); + + // Insert C string + dl = d.Length(); + d.Insert(2, theStr); + EXPECT_EQ(dl + (Standard_Integer)strlen(theStr), d.Length()); + EXPECT_EQ(0, strncmp(d.ToCString() + 1, theStr, strlen(theStr))); + + // Insert char + d = theStr; + d.Insert(i + 1, 'i'); + EXPECT_EQ((Standard_Integer)strlen(theStr) + 1, d.Length()); + EXPECT_EQ('i', d.Value(i + 1)); + EXPECT_STREQ(theStr + i, d.ToCString() + i + 1); + + // Insert TCollection_AsciiString + d = theStr; + d.Insert(i + 1, TCollection_AsciiString("i")); + EXPECT_EQ((Standard_Integer)strlen(theStr) + 1, d.Length()); + EXPECT_EQ('i', d.Value(i + 1)); + EXPECT_STREQ(theStr + i, d.ToCString() + i + 1); + + // IsDifferent + EXPECT_TRUE(d.IsDifferent(theStr)); + EXPECT_TRUE(d.IsDifferent("theStr")); + EXPECT_TRUE(d.IsDifferent("")); + EXPECT_FALSE(d.IsDifferent(d.ToCString())); + } +} diff --git a/src/FoundationClasses/TKernel/GTests/TCollection_ExtendedString_Test.cxx b/src/FoundationClasses/TKernel/GTests/TCollection_ExtendedString_Test.cxx index 2088fe054e..e066f113de 100644 --- a/src/FoundationClasses/TKernel/GTests/TCollection_ExtendedString_Test.cxx +++ b/src/FoundationClasses/TKernel/GTests/TCollection_ExtendedString_Test.cxx @@ -413,3 +413,35 @@ TEST(TCollection_ExtendedStringTest, BoundaryValues) EXPECT_EQ(1, aStringMaxBMP.Length()); EXPECT_FALSE(aStringMaxBMP.IsAscii()); } + +// Test TestMem: Large string memory allocation +// Migrated from QABugs_3.cxx +TEST(TCollection_ExtendedStringTest, TestMem_LargeStringAllocation) +{ + // Test allocation of a large extended string (1MB of characters) + // This test verifies that the string can handle large allocations without crashing + const Standard_Integer aLargeSize = 1024 * 1024; + TCollection_ExtendedString aString(aLargeSize, 'A'); + + EXPECT_EQ(aLargeSize, aString.Length()); + EXPECT_FALSE(aString.IsEmpty()); +} + +// Test OCC3277: TCollection_ExtendedString Cat operation +TEST(TCollection_ExtendedStringTest, OCC3277_CatOperation) +{ + // Test concatenation of an input string to an empty extended string + TCollection_ExtendedString anExtendedString; + TCollection_ExtendedString anInputString("TestString"); + + // Cat() returns a new string, it doesn't modify the original + TCollection_ExtendedString aResult = anExtendedString.Cat(anInputString); + + // Verify the result + EXPECT_EQ(anInputString.Length(), aResult.Length()) + << "Concatenated string should have same length as input"; + EXPECT_FALSE(aResult.IsEmpty()) << "Concatenated string should not be empty"; + + // Verify the content matches + EXPECT_EQ(anInputString, aResult) << "Concatenated string should match input string"; +} diff --git a/src/FoundationClasses/TKernel/GTests/UnitsAPI_Test.cxx b/src/FoundationClasses/TKernel/GTests/UnitsAPI_Test.cxx new file mode 100644 index 0000000000..513b1b008e --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/UnitsAPI_Test.cxx @@ -0,0 +1,29 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +// Test BUC60727: UnitsAPI unit conversion +// Migrated from QABugs_3.cxx +TEST(UnitsAPI_Test, BUC60727_AnyToLS_Conversion) +{ + // Set local system to MDTV (Millimeter, Degree, Ton, Velocity) + UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); + + // Test conversion: 3 mm in the MDTV system should remain 3 + // (since the base unit for length in MDTV is millimeter) + Standard_Real aResult = UnitsAPI::AnyToLS(3.0, "mm"); + EXPECT_DOUBLE_EQ(3.0, aResult); +} diff --git a/src/ModelingAlgorithms/TKBO/GTests/BRepAlgoAPI_Fuse_Test.cxx b/src/ModelingAlgorithms/TKBO/GTests/BRepAlgoAPI_Fuse_Test.cxx index 0162fe8e08..7753f72372 100644 --- a/src/ModelingAlgorithms/TKBO/GTests/BRepAlgoAPI_Fuse_Test.cxx +++ b/src/ModelingAlgorithms/TKBO/GTests/BRepAlgoAPI_Fuse_Test.cxx @@ -2028,3 +2028,24 @@ TEST_F(BFuseSimpleTest, BlendBoxWithCylinderBottomNegY_K9) const TopoDS_Shape aResult = PerformFuse(aBlendedBox, aCylinder); ValidateResult(aResult, 322832); } + +//================================================================================================== +// Additional Tests +//================================================================================================== + +TEST_F(BFuseSimpleTest, OCC277_FuseAndCommonOfOverlappingBoxes) +{ + BRepPrimAPI_MakeBox aBox1Maker(100, 100, 100); + BRepPrimAPI_MakeBox aBox2Maker(gp_Pnt(50, 50, 50), 200, 200, 200); + + TopoDS_Shape aShape1 = aBox1Maker.Shape(); + TopoDS_Shape aShape2 = aBox2Maker.Shape(); + + BRepAlgoAPI_Fuse aFuseOp(aShape1, aShape2); + TopoDS_Shape aFuseResult = aFuseOp.Shape(); + EXPECT_FALSE(aFuseResult.IsNull()); + + BRepAlgoAPI_Common aCommonOp(aShape1, aShape2); + TopoDS_Shape aCommonResult = aCommonOp.Shape(); + EXPECT_FALSE(aCommonResult.IsNull()); +} diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake b/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake index dbb0c31eb7..28e3ce3e0f 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake +++ b/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake @@ -1,6 +1,8 @@ # Test source files for TKGeomAlgo set(OCCT_TKGeomAlgo_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") - + set(OCCT_TKGeomAlgo_GTests_FILES + Geom2dAPI_InterCurveCurve_Test.cxx GeomFill_CorrectedFrenet_Test.cxx + GeomPlate_BuildPlateSurface_Test.cxx ) \ No newline at end of file diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GTests/Geom2dAPI_InterCurveCurve_Test.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GTests/Geom2dAPI_InterCurveCurve_Test.cxx new file mode 100644 index 0000000000..83b34222ae --- /dev/null +++ b/src/ModelingAlgorithms/TKGeomAlgo/GTests/Geom2dAPI_InterCurveCurve_Test.cxx @@ -0,0 +1,66 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +TEST(Geom2dAPI_InterCurveCurve_Test, OCC29289_EllipseIntersectionNewtonRoot) +{ + // Create two ellipses + gp_Elips2d e1(gp_Ax2d(gp_Pnt2d(0., 0.), gp_Dir2d(gp_Dir2d::D::X)), 2., 1.); + Handle(Geom2d_Ellipse) Ge1 = new Geom2d_Ellipse(e1); + gp_Elips2d e2(gp_Ax2d(gp_Pnt2d(0.5, 0.5), gp_Dir2d(1., 1.)), 2., 1.); + Handle(Geom2d_Ellipse) Ge2 = new Geom2d_Ellipse(e2); + + // Find intersection points + Geom2dAPI_InterCurveCurve Intersector; + Intersector.Init(Ge1, Ge2, 1.e-7); + EXPECT_GT(Intersector.NbPoints(), 0) << "Error: intersector found no points"; + + // Setup trigonometric equation: A*Cos(x) + B*Sin(x) + C*Cos(2*x) + D*Sin(2*x) + E + Standard_Real A, B, C, D, E; + A = 1.875; + B = -.75; + C = -.5; + D = -.25; + E = -.25; + math_TrigonometricEquationFunction MyF(A, B, C, D, E); + + Standard_Real Tol1 = 1.e-15; + Standard_Real Eps = 1.5e-12; + Standard_Integer Nit[] = {5, 6, 7, 6}; + + // For each intersection point, verify Newton root finding + Standard_Real TetaPrev = 0.; + Standard_Integer i; + for (i = 1; i <= Intersector.NbPoints(); i++) + { + Standard_Real Teta = Intersector.Intersector().Point(i).ParamOnFirst(); + Standard_Real X = Teta - 0.1 * (Teta - TetaPrev); + TetaPrev = Teta; + + math_NewtonFunctionRoot Resol(MyF, X, Tol1, Eps, Nit[i - 1]); + ASSERT_TRUE(Resol.IsDone()) << "Error: Newton is not done for " << Teta; + + Standard_Real TetaNewton = Resol.Root(); + EXPECT_LE(Abs(Teta - TetaNewton), 1.e-7) << "Error: Newton root is wrong for " << Teta; + } +} diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GTests/GeomPlate_BuildPlateSurface_Test.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GTests/GeomPlate_BuildPlateSurface_Test.cxx new file mode 100644 index 0000000000..4c3e7f073c --- /dev/null +++ b/src/ModelingAlgorithms/TKGeomAlgo/GTests/GeomPlate_BuildPlateSurface_Test.cxx @@ -0,0 +1,30 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +TEST(GeomPlate_BuildPlateSurface, OCC525_PerformWithoutConstraints) +{ + GeomPlate_BuildPlateSurface aBuilder; + aBuilder.Perform(); + + // Note: Due to implementation behavior, IsDone() returns true after Init() + // even though Perform() returns early when there are no constraints. + // The resulting surface is null, which is the expected behavior. + // Original bug OCC525: Bug in GeomPlate_BuildPlateSurface::ComputeSurfInit() + EXPECT_TRUE(aBuilder.IsDone()); + EXPECT_TRUE(aBuilder.Surface().IsNull()) + << "Surface should be null when Perform() is called without constraints"; +} diff --git a/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepLib_MakeWire_Test.cxx b/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepLib_MakeWire_Test.cxx new file mode 100644 index 0000000000..dfb1657aca --- /dev/null +++ b/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepLib_MakeWire_Test.cxx @@ -0,0 +1,25 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +#include + +TEST(BRepLib_MakeWire_Test, OCC30708_2_InitializeWithNullWire) +{ + TopoDS_Wire empty; + + // Should not throw exception when initializing with null wire + EXPECT_NO_THROW(BRepLib_MakeWire aWBuilder(empty)); +} diff --git a/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepOffsetAPI_ThruSections_Test.cxx b/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepOffsetAPI_ThruSections_Test.cxx new file mode 100644 index 0000000000..979112821b --- /dev/null +++ b/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepOffsetAPI_ThruSections_Test.cxx @@ -0,0 +1,80 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include + +// Test OCC10006: BRepOffsetAPI_ThruSections loft operation with Boolean fusion +TEST(BRepOffsetAPI_ThruSections_Test, OCC10006_LoftAndFusion) +{ + // Define bottom and top polygon coordinates for first loft + double aBottomPoints1[12] = {10, -10, 0, 100, -10, 0, 100, -100, 0, 10, -100, 0}; + double aTopPoints1[12] = {0, 0, 10, 100, 0, 10, 100, -100, 10, 0, -100, 10}; + + // Define bottom and top polygon coordinates for second loft + double aBottomPoints2[12] = {0, 0, 10.00, 100, 0, 10.00, 100, -100, 10.00, 0, -100, 10.00}; + double aTopPoints2[12] = {0, 0, 250, 100, 0, 250, 100, -100, 250, 0, -100, 250}; + + // Create polygons + BRepBuilderAPI_MakePolygon aBottomPolygon1, aTopPolygon1, aBottomPolygon2, aTopPolygon2; + gp_Pnt aTmpPnt; + + for (int i = 0; i < 4; i++) + { + aTmpPnt.SetCoord(aBottomPoints1[3 * i], aBottomPoints1[3 * i + 1], aBottomPoints1[3 * i + 2]); + aBottomPolygon1.Add(aTmpPnt); + + aTmpPnt.SetCoord(aTopPoints1[3 * i], aTopPoints1[3 * i + 1], aTopPoints1[3 * i + 2]); + aTopPolygon1.Add(aTmpPnt); + + aTmpPnt.SetCoord(aBottomPoints2[3 * i], aBottomPoints2[3 * i + 1], aBottomPoints2[3 * i + 2]); + aBottomPolygon2.Add(aTmpPnt); + + aTmpPnt.SetCoord(aTopPoints2[3 * i], aTopPoints2[3 * i + 1], aTopPoints2[3 * i + 2]); + aTopPolygon2.Add(aTmpPnt); + } + + // Close polygons + aBottomPolygon1.Close(); + aTopPolygon1.Close(); + aBottomPolygon2.Close(); + aTopPolygon2.Close(); + + // Create first loft (ThruSections) + BRepOffsetAPI_ThruSections aLoft1(Standard_True, Standard_True); + aLoft1.AddWire(aBottomPolygon1.Wire()); + aLoft1.AddWire(aTopPolygon1.Wire()); + aLoft1.Build(); + + // Create second loft (ThruSections) + BRepOffsetAPI_ThruSections aLoft2(Standard_True, Standard_True); + aLoft2.AddWire(aBottomPolygon2.Wire()); + aLoft2.AddWire(aTopPolygon2.Wire()); + aLoft2.Build(); + + // Verify that loft operations succeeded + EXPECT_FALSE(aLoft1.Shape().IsNull()) << "First loft operation should produce a valid shape"; + EXPECT_FALSE(aLoft2.Shape().IsNull()) << "Second loft operation should produce a valid shape"; + + // Perform Boolean fusion of the two lofted shapes + BRepAlgoAPI_Fuse aFusion(aLoft1.Shape(), aLoft2.Shape()); + + // Verify that fusion operation succeeded + EXPECT_FALSE(aFusion.Shape().IsNull()) + << "Boolean fusion of lofted shapes should produce a valid shape"; +} diff --git a/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake b/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake index 93a2650622..6e40956020 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake +++ b/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake @@ -2,4 +2,6 @@ set(OCCT_TKTopAlgo_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKTopAlgo_GTests_FILES + BRepLib_MakeWire_Test.cxx + BRepOffsetAPI_ThruSections_Test.cxx ) diff --git a/src/ModelingData/TKBRep/GTests/BRepAdaptor_CompCurve_Test.cxx b/src/ModelingData/TKBRep/GTests/BRepAdaptor_CompCurve_Test.cxx new file mode 100644 index 0000000000..49eadc52a6 --- /dev/null +++ b/src/ModelingData/TKBRep/GTests/BRepAdaptor_CompCurve_Test.cxx @@ -0,0 +1,59 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include + +// Test OCC5696: BRepAdaptor_CompCurve::Edge() method +// Migrated from QABugs_5.cxx +TEST(BRepAdaptor_CompCurve_Test, OCC5696_EdgeMethod) +{ + // Create a simple edge from two points + TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0, 0, 0), gp_Pnt(2, 0, 0)); + + // Create a wire from the edge + TopoDS_Wire aWire = BRepBuilderAPI_MakeWire(anEdge); + + // Create a composite curve adaptor + BRepAdaptor_CompCurve aCurve(aWire); + + // Get curve parameters + Standard_Real aFirst = aCurve.FirstParameter(); + Standard_Real aLast = aCurve.LastParameter(); + Standard_Real aPar = (aFirst + aLast) / 2.0; + + // Test the Edge() method + Standard_Real aParEdge = 0.0; + TopoDS_Edge anEdgeFound; + + // The original test was checking that this method doesn't throw an exception + // and returns valid parameter + EXPECT_NO_THROW({ aCurve.Edge(aPar, anEdgeFound, aParEdge); }) + << "Edge() method should not throw an exception"; + + // Verify that the returned edge is valid + EXPECT_FALSE(anEdgeFound.IsNull()) << "Returned edge should not be null"; + + // Verify that the parameter is within valid range [0, edge length] + EXPECT_GE(aParEdge, 0.0) << "Edge parameter should be non-negative"; + EXPECT_LE(aParEdge, 2.0) << "Edge parameter should not exceed edge length"; + + // The parameter should be approximately half of the edge length + EXPECT_NEAR(1.0, aParEdge, 0.01) << "Edge parameter should be approximately 1.0"; +} diff --git a/src/ModelingData/TKBRep/GTests/FILES.cmake b/src/ModelingData/TKBRep/GTests/FILES.cmake index 276ac996a7..1d0ccde0cd 100644 --- a/src/ModelingData/TKBRep/GTests/FILES.cmake +++ b/src/ModelingData/TKBRep/GTests/FILES.cmake @@ -2,4 +2,7 @@ set(OCCT_TKBRep_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKBRep_GTests_FILES + BRepAdaptor_CompCurve_Test.cxx + TopoDS_Edge_Test.cxx + TopoDS_Iterator_Test.cxx ) diff --git a/src/ModelingData/TKBRep/GTests/TopoDS_Edge_Test.cxx b/src/ModelingData/TKBRep/GTests/TopoDS_Edge_Test.cxx new file mode 100644 index 0000000000..886f55d25f --- /dev/null +++ b/src/ModelingData/TKBRep/GTests/TopoDS_Edge_Test.cxx @@ -0,0 +1,37 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include + +// Test BUC60828: TopoDS_Edge Infinite flag getter/setter +// Migrated from QABugs_16.cxx +TEST(TopoDS_Edge_Test, BUC60828_InfiniteFlag) +{ + // Create a simple edge + TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0., 0., 0.), gp_Pnt(0., 0., 1.)); + + // Check initial flag value (should be false by default) + Standard_Boolean anInitialValue = anEdge.Infinite(); + EXPECT_FALSE(anInitialValue) << "Initial Infinite flag should be false"; + + // Set the flag to true + anEdge.Infinite(Standard_True); + + // Verify the flag was set correctly + Standard_Boolean aCurrentValue = anEdge.Infinite(); + EXPECT_TRUE(aCurrentValue) << "Infinite flag should be true after setting"; +} diff --git a/src/ModelingData/TKBRep/GTests/TopoDS_Iterator_Test.cxx b/src/ModelingData/TKBRep/GTests/TopoDS_Iterator_Test.cxx new file mode 100644 index 0000000000..e6ba5ca991 --- /dev/null +++ b/src/ModelingData/TKBRep/GTests/TopoDS_Iterator_Test.cxx @@ -0,0 +1,29 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +#include + +TEST(TopoDS_Iterator_Test, OCC30708_1_InitializeWithNullShape) +{ + TopoDS_Iterator it; + TopoDS_Shape empty; + + // Should not throw exception when initializing with null shape + EXPECT_NO_THROW(it.Initialize(empty)); + + // More() should return false on null shape + EXPECT_FALSE(it.More()); +} diff --git a/src/ModelingData/TKG2d/GTests/FILES.cmake b/src/ModelingData/TKG2d/GTests/FILES.cmake index 7b063e35ee..8faa3bf08f 100644 --- a/src/ModelingData/TKG2d/GTests/FILES.cmake +++ b/src/ModelingData/TKG2d/GTests/FILES.cmake @@ -5,4 +5,5 @@ set(OCCT_TKG2d_GTests_FILES Geom2d_BSplineCurve_Test.cxx Geom2d_BezierCurve_Test.cxx Geom2d_OffsetCurve_Test.cxx + Geom2dGcc_Circ2d2TanRad_Test.cxx ) diff --git a/src/ModelingData/TKG2d/GTests/Geom2dGcc_Circ2d2TanRad_Test.cxx b/src/ModelingData/TKG2d/GTests/Geom2dGcc_Circ2d2TanRad_Test.cxx new file mode 100644 index 0000000000..d842090e25 --- /dev/null +++ b/src/ModelingData/TKG2d/GTests/Geom2dGcc_Circ2d2TanRad_Test.cxx @@ -0,0 +1,81 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// Test OCC24303: Geom2dGcc_Circ2d2TanRad - Circle tangent to two ellipses +// Migrated from QABugs_9.cxx +TEST(Geom2dGcc_Circ2d2TanRad_Test, OCC24303_CircleTangentToTwoEllipses) +{ + // Create two ellipses + Standard_Real aMajorRadius = 2.0; + Standard_Real aMinorRadius = 1.0; + gp_Pnt2d aP0(gp::Origin2d()); + gp_Pnt2d aP1(4.0, 0.0); + + gp_Elips2d anEllipse1 = gp_Elips2d(gp_Ax2d(aP0, gp::DX2d()), aMajorRadius, aMinorRadius, true); + gp_Elips2d anEllipse2 = gp_Elips2d(gp_Ax2d(aP1, gp::DX2d()), aMajorRadius, aMinorRadius, true); + + Handle(Geom2d_Curve) aCurve1 = new Geom2d_Ellipse(anEllipse1); + Handle(Geom2d_Curve) aCurve2 = new Geom2d_Ellipse(anEllipse2); + + // Expected tangent circle + gp_Pnt2d aCentre(5.0, 0.0); + Standard_Real aRadius = 3.0; + gp_Circ2d aTheoricalTangent = gp_Circ2d(gp_Ax2d(aCentre, gp::DX2d()), aRadius); + + // Calculate the tangent circles with Geom2dGcc_Circ2d2TanRad + const Geom2dAdaptor_Curve anAdaptedCurve1(aCurve1); + const Geom2dAdaptor_Curve anAdaptedCurve2(aCurve2); + + GccEnt_Position aCurveQualif1 = GccEnt_unqualified; + GccEnt_Position aCurveQualif2 = GccEnt_unqualified; + + const Geom2dGcc_QualifiedCurve aQualifiedCurve1(anAdaptedCurve1, aCurveQualif1); + const Geom2dGcc_QualifiedCurve aQualifiedCurve2(anAdaptedCurve2, aCurveQualif2); + + const Geom2dGcc_Circ2d2TanRad aCircCalc(aQualifiedCurve1, aQualifiedCurve2, aRadius, 1.0e-9); + + const Standard_Integer aNbSol = aCircCalc.NbSolutions(); + + // Verify that solutions were found + EXPECT_GT(aNbSol, 0) << "Should find at least one solution"; + + // Check that all solutions have the correct radius + for (Standard_Integer i = 1; i <= aNbSol; i++) + { + gp_Circ2d aCt = aCircCalc.ThisSolution(i); + EXPECT_NEAR(aRadius, aCt.Radius(), 1.0e-6) + << "Solution " << i << " should have radius " << aRadius; + } + + // For the first solution, check the distance from theoretical tangent + if (aNbSol > 0) + { + gp_Circ2d aCalculatedTangent = aCircCalc.ThisSolution(1); + Standard_Real aDist = aTheoricalTangent.Location().Distance(aCalculatedTangent.Location()); + + // The distance should be relatively small (solutions should be close) + // Note: The exact distance may vary depending on which solution is returned + EXPECT_LT(aDist, 10.0) << "Distance from theoretical tangent should be reasonable"; + } +} diff --git a/src/ModelingData/TKG3d/GTests/FILES.cmake b/src/ModelingData/TKG3d/GTests/FILES.cmake index cee3c93ea7..679da3f866 100644 --- a/src/ModelingData/TKG3d/GTests/FILES.cmake +++ b/src/ModelingData/TKG3d/GTests/FILES.cmake @@ -8,4 +8,6 @@ set(OCCT_TKG3d_GTests_FILES Geom_BSplineSurface_Test.cxx Geom_OffsetCurve_Test.cxx Geom_OffsetSurface_Test.cxx + GeomAPI_ExtremaCurveCurve_Test.cxx + GeomAPI_Interpolate_Test.cxx ) diff --git a/src/ModelingData/TKG3d/GTests/GeomAPI_ExtremaCurveCurve_Test.cxx b/src/ModelingData/TKG3d/GTests/GeomAPI_ExtremaCurveCurve_Test.cxx new file mode 100644 index 0000000000..d88f7e7687 --- /dev/null +++ b/src/ModelingData/TKG3d/GTests/GeomAPI_ExtremaCurveCurve_Test.cxx @@ -0,0 +1,323 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Test OCC862: GeomAPI_ExtremaCurveCurve - Extrema between BSpline and line +TEST(GeomAPI_ExtremaCurveCurve_Test, OCC862_ExtremaBSplineAndLine) +{ + // Define BSpline curve data (from Glob_Poles, Glob_Knots, Glob_Mults) + const Standard_Integer aNbPoles = 195; + const Standard_Real aPoles[195][3] = { + {60000, 31.937047503393231, 799.36226142892554}, + {60000.000000027772, 16.712487623992825, 799.97053069028755}, + {59999.999999875639, 7.3723603687660546, 799.97042131653711}, + {60000.000000331296, 1.2070383839533065, 799.90534456032105}, + {59999.999999361171, -2.5807810139032785, 799.77442818789041}, + {60000.000000952597, -4.7405254527655112, 799.70146419719595}, + {59999.999998867599, -5.3922917628932563, 799.62943054158143}, + {60000.000001091154, -5.1399175234965044, 799.63364074172011}, + {59999.999999142601, -3.6992503431468067, 799.67179299415568}, + {60000.000000546061, -1.6910663098148713, 799.76799688166773}, + {59999.999999725333, 1.1886267067330731, 799.91818018455035}, + {60000.000000101914, 4.5979596894282677, 800.11782874041273}, + {59999.999999977204, 8.5921385739756673, 800.36980220999453}, + {60000.000000018619, 16.600658956791417, 800.90755378048414}, + {59999.999999985768, 26.040687605616604, 801.59827916977554}, + {60000.000000052918, 30.448324872994441, 801.9310695501531}, + {59999.999999883308, 35.089921752286457, 802.29194004854389}, + {60000.000000186978, 39.947755013962528, 802.68007678107051}, + {59999.99999976845, 45.005892525213071, 803.09465896567826}, + {60000.000000227068, 50.249778854659326, 803.53486876081706}, + {59999.999999821659, 55.665932960782108, 803.9998957687626}, + {60000.000000112479, 61.241734208767859, 804.48893829648762}, + {59999.999999943684, 66.965272918611916, 805.00120177704798}, + {60000.000000021486, 72.8252416954995, 805.53589657709654}, + {59999.99999999431, 78.810843745189473, 806.09223572876306}, + {60000.000000004045, 87.962119756404547, 806.95803383418911}, + {59999.99999999725, 97.349976765262795, 807.869010426567}, + {60000.000000017491, 100.50428991828356, 808.17759139897635}, + {59999.99999994829, 103.68239055379394, 808.49099684342912}, + {60000.000000105072, 106.88305649144334, 808.80912918631941}, + {59999.999999835563, 110.10508187457555, 809.13189073948308}, + {60000.000000207947, 113.34727572158297, 809.45918381767103}, + {59999.999999784653, 116.60846040037053, 809.79091039912782}, + {60000.000000180742, 119.88747020406682, 810.12697237079749}, + {59999.999999880296, 123.18314981484644, 810.46727114678265}, + {60000.000000059626, 126.49435287223255, 810.81170785335109}, + {59999.999999979838, 129.81994045902351, 811.16018308253979}, + {60000.000000015229, 134.8281992328765, 811.68880383859914}, + {59999.99999998945, 139.86373510893441, 812.2260602582727}, + {60000.000000059066, 141.54513692067022, 812.40609267860532}, + {59999.999999845008, 143.22928798266199, 812.58705944070834}, + {60000.000000278043, 144.91604799540772, 812.7689478797023}, + {59999.999999621934, 146.60527693312631, 812.95174532592102}, + {60000.000000407505, 148.29683501034282, 813.13543899059755}, + {59999.999999644526, 149.99058265886663, 813.32001613307352}, + {60000.000000252723, 151.68638048575326, 813.5054638442823}, + {59999.999999853622, 153.38408925794459, 813.69176926621947}, + {60000.000000068765, 155.08356985703421, 813.87891939578799}, + {59999.999999973967, 156.7846832610312, 814.06690122038856}, + {60000.00000002468, 159.33859412935516, 814.35010184114628}, + {59999.999999977736, 161.89555354531564, 814.63511466528189}, + {60000.000000145039, 162.74819471256941, 814.73031865086841}, + {59999.999999608634, 163.60113987644607, 814.82572069112655}, + {60000.000000709108, 164.45437167903589, 814.92131914784375}, + {59999.999999031643, 165.3078727497936, 815.0171123286641}, + {60000.000001042623, 166.16162573916125, 815.11309861889924}, + {59999.999999097396, 167.01561326831904, 815.20927628960794}, + {60000.000000630716, 167.86981798631649, 815.30564372626975}, + {59999.999999648215, 168.72422251240596, 815.40219920078994}, + {60000.000000151289, 169.57880948189478, 815.4989410625825}, + {59999.999999954052, 170.43356151298337, 815.5958676029403}, + {60000.000000034408, 171.71591108030151, 815.74153190228753}, + {59999.999999976135, 172.9985538007256, 815.88760410128577}, + {60000.000000129759, 173.42613177350728, 815.93633994702668}, + {59999.999999664251, 173.85373796967124, 815.98512067846866}, + {60000.00000060827, 174.28137021936112, 816.03394612011459}, + {59999.99999914426, 174.70902633885802, 816.08281598496671}, + {60000.000000969369, 175.13670416564241, 816.13173017155248}, + {59999.999999107844, 175.56440150794049, 816.18068832455049}, + {60000.00000066567, 175.9921162052986, 816.22969037578832}, + {59999.999999602165, 176.41984606692156, 816.27873598355484}, + {60000.00000018561, 176.84758892491178, 816.3278250228899}, + {59999.999999935775, 177.27534259516338, 816.37695722529566}, + {60000.000000054533, 177.91698605475608, 816.45071998561696}, + {59999.999999955864, 178.55864403901305, 816.52457892469988}, + {60000.000000281914, 178.7725313764083, 816.54920923644852}, + {59999.999999214248, 178.98641977813006, 816.57385016025694}, + {60000.000001492997, 179.20030898752373, 816.59850173903158}, + {59999.999997853804, 179.41419870083473, 816.62316380941468}, + {60000.000002424618, 179.62808869307457, 816.647836551757}, + {59999.999997816361, 179.84197863289955, 816.6725196831527}, + {60000.000001566797, 180.05586830671322, 816.69721343479125}, + {59999.999999121159, 180.26975739282756, 816.72191756454924}, + {60000.00000036486, 180.48364565146377, 816.74663219124841}, + {59999.999999904954, 180.69753279192835, 816.7713572079532}, + {60000.000000054562, 181.0183614269956, 816.8084603269557}, + {59999.999999978463, 181.33918632988278, 816.84558675379014}, + {60000.000000049782, 181.44612751539663, 816.85796481705847}, + {59999.999999914071, 181.55306821881811, 816.87034546240886}, + {60000.000000125139, 181.66000840292782, 816.88272868833144}, + {59999.999999843392, 181.76694804030186, 816.89511449082431}, + {60000.000000167289, 181.87388708628473, 816.90750286566583}, + {59999.999999847467, 181.98082551962966, 816.9198938103757}, + {60000.000000119864, 182.08776329350809, 816.93228732197861}, + {59999.999999917491, 182.19470038386558, 816.94468339453306}, + {60000.000000050633, 182.30163675019068, 816.9570820285785}, + {59999.999999972366, 182.40857236133851, 816.96948321649302}, + {60000.000000032509, 182.56897459276843, 816.98808882907122}, + {59999.999999965934, 182.7293749693155, 817.00670017517837}, + {60000.000000238462, 182.78284155215263, 817.01290459816312}, + {59999.999999345615, 182.83630791626743, 817.01910964099045}, + {60000.00000119608, 182.88977407140584, 817.02531535916364}, + {59999.999998362182, 182.94323998619015, 817.03152164472851}, + {60000.000001757064, 182.99670569682132, 817.03772865736005}, + {59999.999998499035, 183.05017115047181, 817.04393620474377}, + {60000.00000101691, 183.10363639052409, 817.05014447471717}, + {59999.999999469313, 183.15710137432194, 817.05635331513508}, + {60000.000000196254, 183.21056612270786, 817.06256282498509}, + {59999.999999961823, 183.26403061846696, 817.06877295237007}, + {60000.000000031148, 183.37095910597188, 817.0811944807366}, + {59999.999999975873, 183.47788656385964, 817.09361853568328}, + {60000.000000078871, 183.53291535756762, 817.10001332133618}, + {59999.999999822408, 183.57465447580566, 817.10486251586156}, + {60000.000000306398, 183.67093862701302, 817.11605868308925}, + {59999.999999580868, 183.62493711493508, 817.11070057755603}, + {60000.000000457883, 183.83983154073323, 817.13569840343439}, + {59999.999999600586, 183.70298550843307, 817.11977179379392}, + {60000.000000274122, 183.92091406059222, 817.14512405357789}, + {59999.999999859414, 183.87191278066462, 817.13941945054194}, + {60000.000000045809, 183.96882854112027, 817.15069318206758}, + {59999.99999999682, 184.01172713386404, 817.15568252551441}, + {60000.000000002117, 199.05860625274244, 818.90605990894926}, + {60000.000000011685, 213.77441984052732, 820.66779572748067}, + {59999.999999945896, 228.63273752574398, 822.50191665906459}, + {60000.000000137385, 243.60930053773387, 824.4160390659564}, + {59999.999999745312, 257.44864608947171, 826.20557537898253}, + {60000.000000371336, 272.37732017567259, 828.28374145687258}, + {59999.999999564294, 283.4609507719199, 829.76911975631128}, + {60000.000000411754, 297.87730027160165, 831.94635758332913}, + {59999.999999691667, 308.39894455125989, 833.48120705572103}, + {60000.000000175751, 321.04689540263291, 835.47802201470222}, + {59999.999999930937, 332.7974681685576, 837.36295119087083}, + {60000.000000012922, 344.23852019267594, 839.26003269871717}, + {59999.999999978521, 380.87159046869039, 845.50264944092885}, + {60000.000000031927, 417.67053058140004, 852.32838657260925}, + {59999.999999895757, 443.71876268540638, 857.33613824789597}, + {60000.00000023668, 470.42282907220516, 863.40925211937144}, + {59999.999999591026, 506.36442771103123, 868.70489233101273}, + {60000.000000559063, 504.29569767668107, 873.82665736030435}, + {59999.999999387175, 618.22680165126303, 889.69085497467483}, + {60000.00000054048, 520.96760954336719, 878.60259543512541}, + {59999.999999620944, 695.15397128954748, 909.33199431749756}, + {60000.000000202854, 652.21259368585868, 902.32746593221361}, + {59999.999999925931, 713.31441817738153, 914.25671409207371}, + {60000.000000011525, 744.93626878652026, 920.45067498376648}, + {59999.999999986139, 851.85145355849977, 941.08553924856312}, + {60000.000000015752, 955.13474569084099, 960.32812261133847}, + {59999.99999996031, 1019.9477908992111, 972.25457694191095}, + {60000.000000078573, 1109.7424197388102, 989.27219905591903}, + {59999.999999866697, 1103.4472241364576, 986.24901738812696}, + {60000.000000196575, 1283.5502566789903, 1025.857653448167}, + {59999.999999756859, 1241.170752696316, 1010.5034788173898}, + {60000.000000241002, 1380.0598100152401, 1044.321387312001}, + {59999.999999814674, 1417.3346489504095, 1047.4285724180056}, + {60000.000000106025, 1498.5882349740116, 1064.7148393296281}, + {59999.999999959189, 1562.4075471540843, 1076.5692870450682}, + {60000.000000006847, 1632.0446827427525, 1089.9951747091934}, + {59999.999999992855, 1819.187180960379, 1125.8766969823027}, + {60000.000000006774, 2005.7867190244558, 1161.6893152514506}, + {59999.999999993102, 2127.1610378717864, 1184.8982806691761}, + {59999.999999983789, 2224.9504474907289, 1204.7794295042536}, + {60000.000000076092, 2423.4034586285211, 1239.2849934128672}, + {59999.999999843334, 2352.5108743508281, 1233.9178625300717}, + {60000.00000021555, 2789.1958451831979, 1304.7841887599538}, + {59999.999999781059, 2516.5832651666447, 1267.6317850640198}, + {60000.000000168911, 2997.8479508975411, 1347.2273537129538}, + {59999.999999901927, 2872.9560675152225, 1329.8998228537541}, + {60000.000000040534, 3100.1634765888271, 1371.640798220885}, + {59999.999999990199, 3186.6552406648925, 1389.3336814233451}, + {60000.000000019143, 3570.5318534479206, 1462.8626017289478}, + {59999.999999969914, 3906.3811637172125, 1522.697974792497}, + {60000.000000105116, 4081.0496155485694, 1554.1195061318422}, + {59999.999999764274, 4440.4680391955444, 1682.9362787226369}, + {60000.000000389882, 4025.4579062184348, 1482.6543564450828}, + {59999.999999500047, 5340.2058728577267, 2096.5041911809035}, + {60000.000000509819, 4233.9915572764976, 1518.9299243967394}, + {59999.999999583706, 5430.8345183928068, 2200.8401562891845}, + {60000.000000267981, 5054.5402162751188, 1969.4793692255021}, + {59999.999999871681, 5428.966058504895, 2244.2141001944756}, + {60000.000000038024, 5546.4649349764723, 2352.3606428637349}, + {59999.999999998952, 5706.4753141683368, 2517.0835536242184}, + {59999.999999991771, 6129.2268892602051, 3030.8327236291348}, + {60000.000000020089, 6420.3065439166912, 3661.6495160497966}, + {59999.99999990526, 6235.8646808219391, 3444.1541944672813}, + {60000.000000247288, 8126.8536394010316, 8890.661747328244}, + {59999.99999954299, 2104.925285609057, -7996.1134321147983}, + {60000.00000064441, 14264.475617875083, 34652.739991203249}, + {59999.999999283253, -1684.3290491164355, -33238.811620330394}, + {60000.000000641696, 13782.902589951687, 46532.286752882486}, + {59999.999999532913, 2699.6074087223524, -19079.410940396814}, + {60000.000000275439, 9084.6892111341349, 21937.827319607131}, + {59999.999999871587, 6474.8937324409353, 5006.3713661893671}, + {60000.000000044485, 7350.4434791870981, 10709.698171043074}, + {59999.999999990541, 7306.414330937022, 10560.108503883888}, + {60000, 7397.0783263606427, 11218.963217145942}}; + + const Standard_Integer aNbKnots = 17; + const Standard_Real aKnots[17] = {0, + 0.0087664292723375857, + 0.015654339342331427, + 0.019098294377328347, + 0.020820271894826808, + 0.021681260653576038, + 0.022111755032950653, + 0.022327002222637962, + 0.022434625817481617, + 0.022488437614903441, + 0.022542249412325268, + 0.037523693790797889, + 0.071526893170125505, + 0.1421299556831544, + 0.26514857375331263, + 0.51350664396810353, + 1}; + + const Standard_Integer aMults[17] = + {15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15}; + + // Fill array of poles + TColgp_Array1OfPnt aPolesArray(1, aNbPoles); + for (Standard_Integer i = 0; i < aNbPoles; i++) + { + aPolesArray.SetValue(i + 1, gp_Pnt(aPoles[i][0], aPoles[i][1], aPoles[i][2])); + } + + // Fill array of knots + TColStd_Array1OfReal aKnotsArray(1, aNbKnots); + for (Standard_Integer i = 0; i < aNbKnots; i++) + { + aKnotsArray.SetValue(i + 1, aKnots[i]); + } + + // Fill array of mults + TColStd_Array1OfInteger aMultsArray(1, aNbKnots); + for (Standard_Integer i = 0; i < aNbKnots; i++) + { + aMultsArray.SetValue(i + 1, aMults[i]); + } + + // Create B-Spline curve + const Standard_Integer aDegree = 14; + Handle(Geom_BSplineCurve) aC1 = + new Geom_BSplineCurve(aPolesArray, aKnotsArray, aMultsArray, aDegree); + + // Create trimmed line + gp_XYZ aP1(60000, -7504.83, 6000); + gp_XYZ aP2(60000, 7504.83, 6000); + Handle(Geom_Line) aLine = new Geom_Line(gp_Pnt(aP1), gp_Dir(aP2 - aP1)); + Handle(Geom_TrimmedCurve) aC2 = new Geom_TrimmedCurve(aLine, 0.0, (aP2 - aP1).Modulus()); + + // Try to find extrema + // IMPORTANT: it is not allowed to input infinite curves! + GeomAPI_ExtremaCurveCurve anEx(aC1, aC2); + + // Check if curves are parallel + if (anEx.Extrema().IsParallel()) + { + // Parallel case - should have infinite number of extrema + EXPECT_GT(anEx.LowerDistance(), 0.0) << "Parallel curves should have a distance"; + } + else + { + // Check if extrema were found + const Standard_Integer aNbEx = anEx.NbExtrema(); + EXPECT_GT(aNbEx, 0) << "Extrema should be found between BSpline and line"; + + if (aNbEx > 0) + { + // Get minimal distance data + gp_Pnt aPoint1, aPoint2; + anEx.NearestPoints(aPoint1, aPoint2); + + Standard_Real aU1, aU2; + anEx.LowerDistanceParameters(aU1, aU2); + + const Standard_Real aDistance = anEx.LowerDistance(); + + // Verify minimal distance is reasonable + EXPECT_GE(aDistance, 0.0) << "Minimal distance should be non-negative"; + + // Verify parameters are within valid range [0, 1] for the curves + EXPECT_GE(aU1, 0.0) << "Parameter U1 should be non-negative"; + EXPECT_LE(aU1, 1.0) << "Parameter U1 should not exceed 1.0"; + EXPECT_GE(aU2, 0.0) << "Parameter U2 should be non-negative"; + + // Verify nearest points are valid + EXPECT_FALSE(aPoint1.IsEqual(gp_Pnt(0, 0, 0), 1e-10) + && aPoint2.IsEqual(gp_Pnt(0, 0, 0), 1e-10)) + << "Nearest points should not both be at origin"; + } + } +} diff --git a/src/ModelingData/TKG3d/GTests/GeomAPI_Interpolate_Test.cxx b/src/ModelingData/TKG3d/GTests/GeomAPI_Interpolate_Test.cxx new file mode 100644 index 0000000000..a70a3613e8 --- /dev/null +++ b/src/ModelingData/TKG3d/GTests/GeomAPI_Interpolate_Test.cxx @@ -0,0 +1,71 @@ +// Copyright (c) 2025 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include +#include +#include +#include +#include + +#include + +// Test BUC60902: GeomAPI_Interpolate tangent computation +TEST(GeomAPI_Interpolate_Test, BUC60902_TangentPreservation) +{ + // Create 5 points along a sine wave + Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 5); + gp_Pnt aP(0., 0., 0.); + for (Standard_Integer i = 1; i <= 5; i++) + { + aP.SetX((i - 1) * 1.57); + aP.SetY(sin((i - 1) * 1.57)); + aPnts->SetValue(i, aP); + } + + // First interpolation without tangents + GeomAPI_Interpolate anInterpolater(aPnts, Standard_False, Precision::Confusion()); + anInterpolater.Perform(); + ASSERT_TRUE(anInterpolater.IsDone()) << "First interpolation should succeed"; + + // Get the generated tangents + Handle(Geom_BSplineCurve) aCur = anInterpolater.Curve(); + ASSERT_FALSE(aCur.IsNull()) << "Interpolated curve should not be null"; + + gp_Vec aFirstTang, aLastTang; + aCur->D1(aCur->FirstParameter(), aP, aFirstTang); + aCur->D1(aCur->LastParameter(), aP, aLastTang); + + // Second interpolation with the same tangents explicitly provided + GeomAPI_Interpolate anInterpolater1(aPnts, Standard_False, Precision::Confusion()); + anInterpolater1.Load(aFirstTang, aLastTang, Standard_False); + anInterpolater1.Perform(); + ASSERT_TRUE(anInterpolater1.IsDone()) << "Second interpolation should succeed"; + + // Get the tangents after recomputation + aCur = anInterpolater1.Curve(); + ASSERT_FALSE(aCur.IsNull()) << "Second interpolated curve should not be null"; + + gp_Vec aFirstTang1, aLastTang1; + aCur->D1(aCur->FirstParameter(), aP, aFirstTang1); + aCur->D1(aCur->LastParameter(), aP, aLastTang1); + + // Verify that the tangents are preserved + EXPECT_TRUE(aFirstTang.IsEqual(aFirstTang1, Precision::Confusion(), Precision::Angular())) + << "First tangent should be preserved after recomputation"; + + EXPECT_TRUE(aLastTang.IsEqual(aLastTang1, Precision::Confusion(), Precision::Angular())) + << "Last tangent should be preserved after recomputation"; +} diff --git a/tests/bugs/caf/buc60817 b/tests/bugs/caf/buc60817 deleted file mode 100755 index d73ee77c2b..0000000000 --- a/tests/bugs/caf/buc60817 +++ /dev/null @@ -1,16 +0,0 @@ -puts "===========" -puts "BUC60817" -puts "===========" - -pload QAcommands - -NewDocument D BinOcaf -UndoLimit D 100 - -NewCommand D - -set ResultError [BUC60817 D] -if { ${ResultError} != 0 } { - puts "BUC60817: Error = $ResultError" -} - diff --git a/tests/bugs/caf/buc60925 b/tests/bugs/caf/buc60925 deleted file mode 100755 index 71d4483964..0000000000 --- a/tests/bugs/caf/buc60925 +++ /dev/null @@ -1,19 +0,0 @@ -puts "===========" -puts "BUC60925" -puts "===========" - -pload QAcommands - -NewDocument D BinOcaf -UndoLimit D 100 - -NewCommand D - -set ResultError [BUC60925 D] -if { ${ResultError} != 0 } { - puts "Error : 1" -} - -NewCommand D - - diff --git a/tests/bugs/caf/bug29371 b/tests/bugs/caf/bug29371 deleted file mode 100644 index cecfcba09a..0000000000 --- a/tests/bugs/caf/bug29371 +++ /dev/null @@ -1,8 +0,0 @@ -puts "===========" -puts "OCC29371" -puts "===========" - -pload QAcommands - -OCC29371 - diff --git a/tests/bugs/caf/bug361 b/tests/bugs/caf/bug361 deleted file mode 100755 index c5167ac50d..0000000000 --- a/tests/bugs/caf/bug361 +++ /dev/null @@ -1,15 +0,0 @@ -puts "=================" -puts "OCC361" -puts "BUC60995" -puts "=================" - -pload QAcommands - -NewDocument D BinOcaf - -if { [catch { OCC361 D }] } { - puts "OCC361: Error" -} - -Close D - diff --git a/tests/bugs/fclasses/buc60724 b/tests/bugs/fclasses/buc60724 deleted file mode 100755 index cc9314f4a2..0000000000 --- a/tests/bugs/fclasses/buc60724 +++ /dev/null @@ -1,8 +0,0 @@ -puts "==========" -puts "BUC60724" -puts "==========" - -pload QAcommands - -BUC60724 - diff --git a/tests/bugs/fclasses/buc60727 b/tests/bugs/fclasses/buc60727 deleted file mode 100755 index fb890f624d..0000000000 --- a/tests/bugs/fclasses/buc60727 +++ /dev/null @@ -1,14 +0,0 @@ -puts "=============" -puts "BUC60727" -puts "=============" - -pload QAcommands - -set start [BUC60727] -set n [llength $start] -set end [lindex $start [expr $n-1]] - -if { $end != 3} { - puts "Faulty : Incorrect converting of the unit" -} - diff --git a/tests/bugs/fclasses/bug11758 b/tests/bugs/fclasses/bug11758 deleted file mode 100755 index b3e34e5891..0000000000 --- a/tests/bugs/fclasses/bug11758 +++ /dev/null @@ -1,10 +0,0 @@ -puts "=======" -puts "OCC11758" -puts "=======" -puts "" -########################################################################### TCollection strings are not memory safe as reported by Purify -########################################################################### - -pload QAcommands - -OCC11758 diff --git a/tests/bugs/fclasses/bug132_1 b/tests/bugs/fclasses/bug132_1 deleted file mode 100755 index 42e91a6c4d..0000000000 --- a/tests/bugs/fclasses/bug132_1 +++ /dev/null @@ -1,12 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1/word2} res] { - puts "Error : OCC132" -} - diff --git a/tests/bugs/fclasses/bug132_2 b/tests/bugs/fclasses/bug132_2 deleted file mode 100755 index 33ab96ff5e..0000000000 --- a/tests/bugs/fclasses/bug132_2 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1:word2} res] { - puts "Error : OCC132" -} diff --git a/tests/bugs/fclasses/bug132_3 b/tests/bugs/fclasses/bug132_3 deleted file mode 100755 index b8fca656be..0000000000 --- a/tests/bugs/fclasses/bug132_3 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1*word2} res] { - puts "Error : OCC132" -} diff --git a/tests/bugs/fclasses/bug132_4 b/tests/bugs/fclasses/bug132_4 deleted file mode 100755 index 4923cfe89a..0000000000 --- a/tests/bugs/fclasses/bug132_4 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1?word2} res] { - puts "Error : OCC132" -} diff --git a/tests/bugs/fclasses/bug132_5 b/tests/bugs/fclasses/bug132_5 deleted file mode 100755 index 14a2cce024..0000000000 --- a/tests/bugs/fclasses/bug132_5 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1\"word2} res] { - puts "Error : OCC132" -} diff --git a/tests/bugs/fclasses/bug132_6 b/tests/bugs/fclasses/bug132_6 deleted file mode 100755 index 8cd6364e7e..0000000000 --- a/tests/bugs/fclasses/bug132_6 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1word2} res] { - puts "Error : OCC132" -} diff --git a/tests/bugs/fclasses/bug132_8 b/tests/bugs/fclasses/bug132_8 deleted file mode 100755 index 1a59d4ded2..0000000000 --- a/tests/bugs/fclasses/bug132_8 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1|word2} res] { - puts "Error : OCC132" -} diff --git a/tests/bugs/fclasses/bug132_9 b/tests/bugs/fclasses/bug132_9 deleted file mode 100755 index 9deb676b83..0000000000 --- a/tests/bugs/fclasses/bug132_9 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC132" -puts "BUC61029" -puts "BUC61030" -puts "========" - -pload QAcommands - -if [catch {OCC132 word1.word2.word3} res] { - puts "Error : OCC132" -} diff --git a/tests/bugs/fclasses/bug22980 b/tests/bugs/fclasses/bug22980 deleted file mode 100755 index d8c69cef8b..0000000000 --- a/tests/bugs/fclasses/bug22980 +++ /dev/null @@ -1,11 +0,0 @@ -puts "============" -puts "OCC22980" -puts "============" -puts "" -####################################################################### -# Fixed Standard_Atomic.hxx -####################################################################### - -pload QAcommands - -OCC22980 diff --git a/tests/bugs/fclasses/bug23361 b/tests/bugs/fclasses/bug23361 deleted file mode 100755 index 8e239e4531..0000000000 --- a/tests/bugs/fclasses/bug23361 +++ /dev/null @@ -1,11 +0,0 @@ -puts "============" -puts "CR23361" -puts "===========" -puts "" -################################################ -# Bug in gp_Trsf::Multiply -################################################ - -pload QAcommands - -OCC23361 diff --git a/tests/bugs/fclasses/bug24271 b/tests/bugs/fclasses/bug24271 deleted file mode 100644 index b7fc1fc16c..0000000000 --- a/tests/bugs/fclasses/bug24271 +++ /dev/null @@ -1,11 +0,0 @@ -puts "================" -puts "OCC24271" -puts "================" -puts "" -####################################################################### -# validate boolean operations on NCollection_Map -####################################################################### - -pload QAcommands - -OCC24271 diff --git a/tests/bugs/fclasses/bug24533 b/tests/bugs/fclasses/bug24533 deleted file mode 100755 index 4d4668d45f..0000000000 --- a/tests/bugs/fclasses/bug24533 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC24533" -puts "========" -puts "" -#################################################### -## Use 0 to check null handle instead of UndefinedHandleAccess -#################################################### - -pload QAcommands - -OCC24533 diff --git a/tests/bugs/fclasses/bug29406 b/tests/bugs/fclasses/bug29406 deleted file mode 100644 index 950c8d4c3c..0000000000 --- a/tests/bugs/fclasses/bug29406 +++ /dev/null @@ -1,7 +0,0 @@ -puts "============" -puts "0029406: Foundation Classes - gp_Ax3 fails setting direction" -puts "============" -puts "" - -pload QAcommands -OCC29406 diff --git a/tests/bugs/fclasses/bug29925 b/tests/bugs/fclasses/bug29925 deleted file mode 100644 index 1d8f8d1cc2..0000000000 --- a/tests/bugs/fclasses/bug29925 +++ /dev/null @@ -1,9 +0,0 @@ -puts "# ======================================================================" -puts "# 0029925: Foundation Classes - add missing cast to LowerCase() and UpperCase() arguments" -puts "# ======================================================================" -puts "" - -pload QAcommands - -puts "Check safety of character classification functions for all valid chars" -OCC29925 diff --git a/tests/bugs/fclasses/bug309 b/tests/bugs/fclasses/bug309 deleted file mode 100644 index f4a742a13a..0000000000 --- a/tests/bugs/fclasses/bug309 +++ /dev/null @@ -1,49 +0,0 @@ -puts "TODO OCC24296 Linux: OCC309: Error 2" -puts "TODO OCC24296 MacOS: OCC309: Error 2" - -puts "================" -puts "OCC309" -puts "================" -puts "" - -pload QAcommands - -set result [OCC309] - -set ll [llength ${result}] -if { ${ll} != 2 } { - puts "result = ${result}" - puts "length = ${ll}" - puts "OCC309: Error 0" -} else { - set result1 [lindex ${result} 0] - set result2 [lindex ${result} 1] - set CurrentDirectory [pwd] - set UpTrek "[file join [file dirname [file dirname ${CurrentDirectory}]] [file tail ${CurrentDirectory}]]" - if { [checkplatform -windows] } { - set res1 [ string range $result1 3 [expr [string length $result1] -2 ] ] - set res2 [ string range $result2 3 [expr [string length $result2] -2 ] ] - set CurrentDirectory [ string range $CurrentDirectory 2 [expr [string length $CurrentDirectory] -1 ]] - set UpTrek [ string range $UpTrek 2 [expr [string length $UpTrek] -1 ]] - } else { - set res1 [ string range $result1 1 [expr [string length $result1] -3 ] ] - set res2 [ string range $result2 1 [expr [string length $result2] -3 ] ] - } - if {[string compare ${res1} "${CurrentDirectory}"] == 0} { - puts "OCC309: OK 1" - } else { - puts "result1 = ${result1}" - puts "res1 = ${res1}" - puts "CurrentDirectory = ${CurrentDirectory}" - puts "OCC309: Error 1" - } - if {[string compare ${res2} "${UpTrek}"] == 0} { - puts "OCC309: OK 2" - } else { - puts "result2 = ${result2}" - puts "res2 = ${res2}" - puts "UpTrek = ${UpTrek}" - puts "OCC309: Error 2" - } -} - diff --git a/tests/bugs/fclasses/bug310 b/tests/bugs/fclasses/bug310 deleted file mode 100644 index 0dae584b6e..0000000000 --- a/tests/bugs/fclasses/bug310 +++ /dev/null @@ -1,35 +0,0 @@ -puts "================" -puts "OCC310" -puts "================" -puts "" - -pload QAcommands - -set result [OCC310] - -set ll [llength ${result}] -if { ${ll} != 2 } { - puts "result = ${result}" - puts "length = ${ll}" - puts "OCC310: ERROR 0" -} else { - set result1 [lindex ${result} 0] - set result2 [lindex ${result} 1] - set Directory "|where|you|want|tmp|qwerty|tmp|" - set UpTrek "|where|you|want|tmp|qwerty|" - if {[string compare ${result1} "${Directory}"] == 0} { - puts "OCC310: OK 1" - } else { - puts "result1 = ${result1}" - puts "Directory = ${Directory}" - puts "OCC310: ERROR 1" - } - if {[string compare ${result2} "${UpTrek}"] == 0} { - puts "OCC310: OK 2" - } else { - puts "result2 = ${result2}" - puts "UpTrek = ${UpTrek}" - puts "OCC310: ERROR 2" - } -} - diff --git a/tests/bugs/fclasses/bug33048 b/tests/bugs/fclasses/bug33048 deleted file mode 100644 index d47f4c990e..0000000000 --- a/tests/bugs/fclasses/bug33048 +++ /dev/null @@ -1,9 +0,0 @@ -puts "============" -puts "0033048: Foundation Classes - math_ComputeKronrodPointsAndWeights indexation go beyond the limit" -puts "============" -puts "" - -cpulimit 30 - -pload QAcommands -OCC33048 diff --git a/tests/bugs/fclasses/bug6794 b/tests/bugs/fclasses/bug6794 deleted file mode 100755 index 4aaf90f21c..0000000000 --- a/tests/bugs/fclasses/bug6794 +++ /dev/null @@ -1,27 +0,0 @@ -puts "============" -puts "OCC6794" -puts "============" -puts "" -###################################################### -# AsciiString corrputs memory in case of MMGT_OPT equal to 0 -###################################################### - -pload QAcommands -set BugNumber OCC6794 -set nb 40009 -set env(MMGT_OPT) 0 -set OPT $env(MMGT_OPT) - -if { ${OPT} != 0 } { - puts "env(MMGT_OPT) = $env(MMGT_OPT)" - puts "Faulty ${BugNumber}" -} else { - set result [OCC6794 ${nb}] - regexp {Use nb += +([-0-9.+eE]+)} $result full use_nb - regexp {aLength += +([-0-9.+eE]+)} $result full ll - - if { ${use_nb} != ${nb} || ${ll} != ${nb} } { - puts "Faulty ${BugNumber}" - } -} - diff --git a/tests/bugs/modalg_3/bug22595 b/tests/bugs/modalg_3/bug22595 deleted file mode 100644 index 5994721ede..0000000000 --- a/tests/bugs/modalg_3/bug22595 +++ /dev/null @@ -1,51 +0,0 @@ -puts "============" -puts "OCC22595" -puts "============" -puts "" -###################################################### -# gp_Mat's constructors incompletely initialize memory -###################################################### - -set BugNumber OCC22595 -pload QAcommands - -set Min_ListLength 11 - -set List [ OCC22595 ] - -set status 0 -set ListLength [llength ${List}] - -if { ${ListLength} != ${Min_ListLength}} { - set status 1 - puts "Error: ListLength = ${ListLength}" -} - -set index0 0 -set M11 [lindex ${List} [expr ${index0} +2]] -set M12 [lindex ${List} [expr ${index0} + 3 ]] -set M13 [lindex ${List} [expr ${index0} + 4 ]] -set M21 [lindex ${List} [expr ${index0} + 5 ]] -set M22 [lindex ${List} [expr ${index0} + 6 ]] -set M23 [lindex ${List} [expr ${index0} + 7 ]] -set M31 [lindex ${List} [expr ${index0} + 8 ]] -set M32 [lindex ${List} [expr ${index0} + 9 ]] -set M33 [lindex ${List} [expr ${index0} + 10 ]] - -if { ${M11} != 0 || ${M12} != 0 || ${M13} != 0 } { - set status 1 -} -if { ${M21} != 0 || ${M22} != 0 || ${M23} != 0 } { - set status 1 -} -if { ${M31} != 0 || ${M32} != 0 || ${M33} != 0 } { - set status 1 -} -if { $status != 0 } { - puts "Faulty $BugNumber" -} else { - puts "OK $BugNumber" -} - - - diff --git a/tests/bugs/modalg_5/bug24303 b/tests/bugs/modalg_5/bug24303 deleted file mode 100755 index 7a8d18d6de..0000000000 --- a/tests/bugs/modalg_5/bug24303 +++ /dev/null @@ -1,66 +0,0 @@ -puts "============" -puts "OCC24303" -puts "============" -puts "" -############################### -## Precision degradation for Geom2dGcc_Circ2d2TanRad in OCCT6.6.0. -############################### - -pload QAcommands - -set status 0 - -set info1 [OCC24303 5] -regexp {Solutions +([-0-9.+eE]+)} ${info1} full Solution -regexp {Distance += +([-0-9.+eE]+)} ${info1} full Distance - -if { [info exists Sol5] } { - set info2 [dump Sol5] - regexp {Center +:([-0-9.+eE]+), +([-0-9.+eE]+)} ${info2} full CenterX CenterY - regexp {XAxis +:([-0-9.+eE]+), +([-0-9.+eE]+)} ${info2} full XAxisX XAxisY - regexp {YAxis +:([-0-9.+eE]+), +([-0-9.+eE]+)} ${info2} full YAxisX YAxisY - regexp {Radius +:([-0-9.+eE]+)} ${info2} full Radius - set good_CenterX 5 - set good_CenterY 0 - set good_XAxisX 1 - set good_XAxisY 0 - set good_YAxisX 0 - set good_YAxisY 1 - set good_Radius 3 - - set SQDistCC [expr ($CenterX-$good_CenterX)*($CenterX-$good_CenterX)+($CenterY-$good_CenterY)*($CenterY-$good_CenterY)] - - if { ${SQDistCC} > 1.0e-14 } { - puts "Faulty : Bad Center of the circle" - set status 1 - } - if { ${XAxisX} != ${good_XAxisX} } { - puts "Faulty : Bad XAxisX" - set status 2 - } - if { ${XAxisY} != ${good_XAxisY} } { - puts "Faulty : Bad XAxisY" - set status 3 - } - if { ${YAxisX} != ${good_YAxisX} } { - puts "Faulty : Bad YAxisX" - set status 4 - } - if { ${YAxisY} != ${good_YAxisY} } { - puts "Faulty : Bad YAxisY" - set status 5 - } - if { ${Radius} != ${good_Radius} } { - puts "Faulty : Bad Radius" - set status 6 - } - } else { - puts "Faulty : Bad solution" - set status 7 -} - -if { ${status} != 0 } { - puts "Faulty : solution is wrong. Status = ${status}" -} else { - puts "OK : solution is correct" -} diff --git a/tests/bugs/modalg_7/bug29289 b/tests/bugs/modalg_7/bug29289 deleted file mode 100644 index 6bb40c80cb..0000000000 --- a/tests/bugs/modalg_7/bug29289 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC29289" -puts "========" -puts "" - -################################################################ -# Wrong derivatives in math_TrigonometricFunctionRoots.cxx file. -################################################################ - -pload QAcommands -OCC29289 diff --git a/tests/bugs/moddata_1/buc60729 b/tests/bugs/moddata_1/buc60729 deleted file mode 100755 index 7f97b096ef..0000000000 --- a/tests/bugs/moddata_1/buc60729 +++ /dev/null @@ -1,14 +0,0 @@ - -puts "========================" -puts "BUC60729" -puts "========================" - -pload QAcommands - -if [catch {BUC60729} ] { - puts "BUC60729: Error" -} else { - puts "BUC60729: OK" -} - -checkview -display result -3d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/moddata_1/buc60828 b/tests/bugs/moddata_1/buc60828 deleted file mode 100755 index c7e74d203b..0000000000 --- a/tests/bugs/moddata_1/buc60828 +++ /dev/null @@ -1,11 +0,0 @@ - -puts "========" -puts "BUC60828" -puts "========" -puts "" - -catch {BUC60828} - - - - diff --git a/tests/bugs/moddata_1/buc60902 b/tests/bugs/moddata_1/buc60902 deleted file mode 100755 index 9ff97594ce..0000000000 --- a/tests/bugs/moddata_1/buc60902 +++ /dev/null @@ -1,14 +0,0 @@ -puts "========" -puts "BUC60902" -puts "========" - -pload QAcommands - -set info [BUC60902] - -if { [regexp "First tangent is OK" $info] != 1 && [regexp "Last tangent is OK" $info] != 1 } { - puts "Error : Result is invalid" -} - - - diff --git a/tests/bugs/moddata_2/bug277 b/tests/bugs/moddata_2/bug277 deleted file mode 100755 index 91cb0336e5..0000000000 --- a/tests/bugs/moddata_2/bug277 +++ /dev/null @@ -1,17 +0,0 @@ -puts "========" -puts "OCC277" -puts "========" -puts "" - -pload QAcommands - -OCC277 - -set listmem {} -set i_max 10 -for {set i 1} {${i} <= ${i_max}} {incr i} { - OCC277 - - lappend listmem [meminfo h] - checktrend $listmem 0 1 "Memory leak detected" -} diff --git a/tests/bugs/moddata_2/bug525 b/tests/bugs/moddata_2/bug525 deleted file mode 100755 index ccf98679a3..0000000000 --- a/tests/bugs/moddata_2/bug525 +++ /dev/null @@ -1,19 +0,0 @@ -puts "REQUIRED All: Error in OCC525. Null result is expected." - -pload QAcommands - -puts "========" -puts "OCC525" -puts "========" -puts "" -######################################################## -## Bug in GeomPlate_BuildPlateSurface::ComputeSurfInit() -######################################################## - -set mistake 0 - -if { [catch { OCC525 } ] } { - puts "Faulty : OCC525" -} - -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/moddata_2/bug5696 b/tests/bugs/moddata_2/bug5696 deleted file mode 100755 index a8abf8aaa9..0000000000 --- a/tests/bugs/moddata_2/bug5696 +++ /dev/null @@ -1,21 +0,0 @@ -pload QAcommands - -puts "================" -puts "OCC5696" -puts "================" -puts "" -####################################################################################### -# Exception in BRepAdaptor_CompCurve due to uninitialised variable CurIndex -####################################################################################### - -set BugNumber OCC5696 - -set info_result [OCC5696] -set index [string compare ${info_result} "par_edge = 1\n"] -if {$index != 0} { - puts "Faulty ${BugNumber}" -} else { - puts "OK ${BugNumber}" -} - - diff --git a/tests/bugs/moddata_3/bug30708_1 b/tests/bugs/moddata_3/bug30708_1 deleted file mode 100644 index cd6149a528..0000000000 --- a/tests/bugs/moddata_3/bug30708_1 +++ /dev/null @@ -1,10 +0,0 @@ -puts "================" -puts "0030708: Modeling Data - Crash while initializing TopoDS_Iterator with null shape" -puts "================" -puts "" - -pload QAcommands - -if { [regexp "Cannot initialize" [OCC30708_1]]} { - puts "Error: Cannot initialize TopoDS_Iterator with null shape" -} diff --git a/tests/bugs/moddata_3/bug30708_2 b/tests/bugs/moddata_3/bug30708_2 deleted file mode 100644 index 4acb278cc6..0000000000 --- a/tests/bugs/moddata_3/bug30708_2 +++ /dev/null @@ -1,10 +0,0 @@ -puts "================" -puts "0030708: Modeling Data - Crash while initializing TopoDS_Iterator with null shape" -puts "================" -puts "" - -pload QAcommands - -if { [regexp "Cannot initialize" [OCC30708_2]]} { - puts "Error: Cannot initialize BRepLib_MakeWire with null wire" -} diff --git a/tests/bugs/moddata_3/bug33009 b/tests/bugs/moddata_3/bug33009 deleted file mode 100644 index 9b0c272863..0000000000 --- a/tests/bugs/moddata_3/bug33009 +++ /dev/null @@ -1,7 +0,0 @@ -puts "=============================================================================================" -puts "0033009: Foundation Classes - Bnd_OBB::ReBuild() expects point array starting from 0" -puts "=============================================================================================" -puts "" - -pload QAcommands -OCC33009