From 396b677095069ba98e54342acfc9fc22b9c3089d Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Thu, 13 Nov 2025 09:28:07 +0000 Subject: [PATCH] Testing - Migrate QA DRAW tests to GTest (#823) - Deletion of 20 legacy DRAW test files (.tcl format) from tests/bugs/ directories - Addition of 15 new GTest C++ test files across multiple modules - Removal of corresponding QA command implementations from TKQADraw --- .../TKLCAF/GTests/FILES.cmake | 1 + .../GTests/TDF_AttributeIterator_Test.cxx | 60 +++ .../TKXCAF/GTests/FILES.cmake | 6 + .../TKXCAF/GTests/XCAFDoc_Test.cxx | 107 +++++ src/Draw/TKQADraw/QABugs/QABugs_11.cxx | 169 -------- src/Draw/TKQADraw/QABugs/QABugs_17.cxx | 82 ---- src/Draw/TKQADraw/QABugs/QABugs_19.cxx | 386 +----------------- src/Draw/TKQADraw/QABugs/QABugs_20.cxx | 221 +--------- .../TKMath/GTests/Bnd_OBB_Test.cxx | 46 +++ .../TKMath/GTests/math_BFGS_Test.cxx | 69 ++++ .../TKernel/GTests/FILES.cmake | 4 + .../TKernel/GTests/Message_Messenger_Test.cxx | 143 +++++++ .../TKernel/GTests/NCollection_List_Test.cxx | 35 ++ .../GTests/NCollection_Sequence_Test.cxx | 21 + .../TKernel/GTests/Standard_Failure_Test.cxx | 45 ++ .../TKernel/GTests/Standard_GUID_Test.cxx | 123 ++++++ .../TKernel/GTests/TopLoc_Location_Test.cxx | 91 +++++ .../GTests/Expr_GeneralExpression_Test.cxx | 54 +++ .../TKExpress/GTests/FILES.cmake | 1 + .../TKGeomAlgo/GTests/FILES.cmake | 1 + .../GTests/Geom2dGcc_Circ2d3Tan_Test.cxx | 77 ++++ .../TKMesh/GTests/BRepMesh_GeomTool_Test.cxx | 86 ++++ .../TKMesh/GTests/FILES.cmake | 1 + .../GTests/BRepPrimAPI_MakePrism_Test.cxx | 42 ++ .../TKPrim/GTests/FILES.cmake | 1 + .../GTests/BRepBuilderAPI_MakeWire_Test.cxx | 71 ++++ .../TKTopAlgo/GTests/FILES.cmake | 1 + src/ModelingData/TKG2d/GTests/FILES.cmake | 2 + .../GTests/Geom2dAPI_InterCurveCurve_Test.cxx | 75 ++++ .../GTests/Geom2dGcc_Circ2d2TanOn_Test.cxx | 75 ++++ tests/bugs/caf/bug24755 | 7 - tests/bugs/caf/bug669 | 158 ------- tests/bugs/caf/bug738_1 | 17 - tests/bugs/caf/bug738_2 | 17 - tests/bugs/fclasses/bug24836 | 11 - tests/bugs/fclasses/bug25348 | 11 - tests/bugs/fclasses/bug25545 | 11 - tests/bugs/fclasses/bug26448 | 10 - tests/bugs/fclasses/bug30492 | 8 - tests/bugs/fclasses/bug31189 | 22 - tests/bugs/fclasses/bug670 | 11 - tests/bugs/fclasses/bug902 | 31 -- tests/bugs/mesh/bug25547 | 11 - tests/bugs/modalg_5/bug24889 | 38 -- tests/bugs/modalg_6/bug27357 | 16 - tests/bugs/modalg_6/bug27552_3 | 16 - tests/bugs/modalg_7/bug31294 | 8 - tests/bugs/moddata_2/bug353 | 16 - tests/bugs/moddata_3/bug30704 | 15 - tests/bugs/xde/bug23595 | 11 - 50 files changed, 1242 insertions(+), 1299 deletions(-) create mode 100644 src/ApplicationFramework/TKLCAF/GTests/TDF_AttributeIterator_Test.cxx create mode 100644 src/ApplicationFramework/TKXCAF/GTests/FILES.cmake create mode 100644 src/ApplicationFramework/TKXCAF/GTests/XCAFDoc_Test.cxx create mode 100644 src/FoundationClasses/TKernel/GTests/Message_Messenger_Test.cxx create mode 100644 src/FoundationClasses/TKernel/GTests/Standard_Failure_Test.cxx create mode 100644 src/FoundationClasses/TKernel/GTests/Standard_GUID_Test.cxx create mode 100644 src/FoundationClasses/TKernel/GTests/TopLoc_Location_Test.cxx create mode 100644 src/ModelingAlgorithms/TKExpress/GTests/Expr_GeneralExpression_Test.cxx create mode 100644 src/ModelingAlgorithms/TKGeomAlgo/GTests/Geom2dGcc_Circ2d3Tan_Test.cxx create mode 100644 src/ModelingAlgorithms/TKMesh/GTests/BRepMesh_GeomTool_Test.cxx create mode 100644 src/ModelingAlgorithms/TKPrim/GTests/BRepPrimAPI_MakePrism_Test.cxx create mode 100644 src/ModelingAlgorithms/TKTopAlgo/GTests/BRepBuilderAPI_MakeWire_Test.cxx create mode 100644 src/ModelingData/TKG2d/GTests/Geom2dAPI_InterCurveCurve_Test.cxx create mode 100644 src/ModelingData/TKG2d/GTests/Geom2dGcc_Circ2d2TanOn_Test.cxx delete mode 100755 tests/bugs/caf/bug24755 delete mode 100755 tests/bugs/caf/bug669 delete mode 100755 tests/bugs/caf/bug738_1 delete mode 100755 tests/bugs/caf/bug738_2 delete mode 100644 tests/bugs/fclasses/bug24836 delete mode 100644 tests/bugs/fclasses/bug25348 delete mode 100644 tests/bugs/fclasses/bug25545 delete mode 100644 tests/bugs/fclasses/bug26448 delete mode 100644 tests/bugs/fclasses/bug30492 delete mode 100644 tests/bugs/fclasses/bug31189 delete mode 100755 tests/bugs/fclasses/bug670 delete mode 100755 tests/bugs/fclasses/bug902 delete mode 100755 tests/bugs/mesh/bug25547 delete mode 100644 tests/bugs/modalg_5/bug24889 delete mode 100644 tests/bugs/modalg_6/bug27357 delete mode 100644 tests/bugs/modalg_6/bug27552_3 delete mode 100644 tests/bugs/modalg_7/bug31294 delete mode 100755 tests/bugs/moddata_2/bug353 delete mode 100644 tests/bugs/moddata_3/bug30704 delete mode 100755 tests/bugs/xde/bug23595 diff --git a/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake b/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake index 1e8e815943..dc8c6669e4 100644 --- a/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake +++ b/src/ApplicationFramework/TKLCAF/GTests/FILES.cmake @@ -4,6 +4,7 @@ set(OCCT_TKLCAF_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKLCAF_GTests_FILES TDataStd_Attribute_Test.cxx TDataStd_TreeNode_Test.cxx + TDF_AttributeIterator_Test.cxx TNaming_Builder_Test.cxx TNaming_Name_Test.cxx ) diff --git a/src/ApplicationFramework/TKLCAF/GTests/TDF_AttributeIterator_Test.cxx b/src/ApplicationFramework/TKLCAF/GTests/TDF_AttributeIterator_Test.cxx new file mode 100644 index 0000000000..300d94e95c --- /dev/null +++ b/src/ApplicationFramework/TKLCAF/GTests/TDF_AttributeIterator_Test.cxx @@ -0,0 +1,60 @@ +// 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(TDF_AttributeIterator_Test, OCC24755_AttributeInsertionOrder) +{ + Handle(TDocStd_Application) anApp = new TDocStd_Application(); + Handle(TDocStd_Document) aDoc; + anApp->NewDocument("BinOcaf", aDoc); + TDF_Label aLab = aDoc->Main(); + + // Prepend an int value. + TDataStd_Integer::Set(aLab, 0); + // Prepend a name. + TDataStd_Name::Set(aLab, "test"); + // Append a double value. + aLab.AddAttribute(new TDataStd_Real(), true /*append*/); + + // Verify that attributes are iterated in the expected order: + // Integer (prepended second, so it's first), Name (prepended first), Real (appended) + TDF_AttributeIterator anIter(aLab); + + ASSERT_TRUE(anIter.More()) << "Iterator should have first attribute"; + Handle(TDF_Attribute) anAttr = anIter.Value(); + EXPECT_TRUE(anAttr->IsKind(STANDARD_TYPE(TDataStd_Integer))) + << "First attribute should be TDataStd_Integer"; + + anIter.Next(); + ASSERT_TRUE(anIter.More()) << "Iterator should have second attribute"; + anAttr = anIter.Value(); + EXPECT_TRUE(anAttr->IsKind(STANDARD_TYPE(TDataStd_Name))) + << "Second attribute should be TDataStd_Name"; + + anIter.Next(); + ASSERT_TRUE(anIter.More()) << "Iterator should have third attribute"; + anAttr = anIter.Value(); + EXPECT_TRUE(anAttr->IsKind(STANDARD_TYPE(TDataStd_Real))) + << "Third attribute should be TDataStd_Real"; + + anIter.Next(); + EXPECT_FALSE(anIter.More()) << "Iterator should have no more attributes"; +} diff --git a/src/ApplicationFramework/TKXCAF/GTests/FILES.cmake b/src/ApplicationFramework/TKXCAF/GTests/FILES.cmake new file mode 100644 index 0000000000..0597af7f42 --- /dev/null +++ b/src/ApplicationFramework/TKXCAF/GTests/FILES.cmake @@ -0,0 +1,6 @@ +# Test source files for TKXCAF +set(OCCT_TKXCAF_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") + +set(OCCT_TKXCAF_GTests_FILES + XCAFDoc_Test.cxx +) diff --git a/src/ApplicationFramework/TKXCAF/GTests/XCAFDoc_Test.cxx b/src/ApplicationFramework/TKXCAF/GTests/XCAFDoc_Test.cxx new file mode 100644 index 0000000000..611ed529fd --- /dev/null +++ b/src/ApplicationFramework/TKXCAF/GTests/XCAFDoc_Test.cxx @@ -0,0 +1,107 @@ +// 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(XCAFDoc_Test, OCC738_ShapeRefGUID) +{ + // Bug OCC738: The GUIDs in XCAFDoc have incorrect format + // This test verifies that XCAFDoc::ShapeRefGUID() returns a valid GUID + + Standard_GUID aGUID; + EXPECT_NO_THROW(aGUID = XCAFDoc::ShapeRefGUID()); + + // Verify the GUID is not null (all zeros) + Standard_GUID aNullGUID("00000000-0000-0000-0000-000000000000"); + EXPECT_NE(aGUID, aNullGUID) << "ShapeRefGUID should not be null"; +} + +TEST(XCAFDoc_Test, OCC738_AssemblyGUID) +{ + // Bug OCC738: The GUIDs in XCAFDoc have incorrect format + // This test verifies that XCAFDoc::AssemblyGUID() returns a valid GUID + + Standard_GUID aGUID; + EXPECT_NO_THROW(aGUID = XCAFDoc::AssemblyGUID()); + + // Verify the GUID is not null (all zeros) + Standard_GUID aNullGUID("00000000-0000-0000-0000-000000000000"); + EXPECT_NE(aGUID, aNullGUID) << "AssemblyGUID should not be null"; +} + +// RAII guard to save and restore XCAFDoc_ShapeTool AutoNaming state +class AutoNamingGuard +{ +public: + AutoNamingGuard() + : mySavedValue(XCAFDoc_ShapeTool::AutoNaming()) + { + } + + ~AutoNamingGuard() { XCAFDoc_ShapeTool::SetAutoNaming(mySavedValue); } + + // Disable copy and move + AutoNamingGuard(const AutoNamingGuard&) = delete; + AutoNamingGuard& operator=(const AutoNamingGuard&) = delete; + +private: + Standard_Boolean mySavedValue; +}; + +TEST(XCAFDoc_Test, OCC23595_AutoNaming) +{ + // Bug OCC23595: XCAFDoc_ShapeTool extended with two methods - + // SetAutoNaming() and AutoNaming() + // This test verifies that the AutoNaming feature works correctly + + // RAII guard to automatically restore AutoNaming state on exit (exception-safe) + AutoNamingGuard aGuard; + + // Create a new XmlXCAF document + Handle(TDocStd_Application) anApp = new TDocStd_Application(); + Handle(TDocStd_Document) aDoc; + anApp->NewDocument("XmlXCAF", aDoc); + ASSERT_FALSE(aDoc.IsNull()); + + Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main()); + + // Check default value of AutoNaming + Standard_Boolean aValue = XCAFDoc_ShapeTool::AutoNaming(); + EXPECT_TRUE(aValue) << "AutoNaming should be true by default"; + + // Test with AutoNaming enabled (true) + XCAFDoc_ShapeTool::SetAutoNaming(Standard_True); + TopoDS_Shape aShape1 = BRepPrimAPI_MakeBox(100., 200., 300.).Shape(); + TDF_Label aLabel1 = aShTool->AddShape(aShape1); + Handle(TDataStd_Name) anAttr; + EXPECT_TRUE(aLabel1.FindAttribute(TDataStd_Name::GetID(), anAttr)) + << "Shape should have a name attribute when AutoNaming is true"; + + // Test with AutoNaming disabled (false) + XCAFDoc_ShapeTool::SetAutoNaming(Standard_False); + TopoDS_Shape aShape2 = BRepPrimAPI_MakeBox(300., 200., 100.).Shape(); + TDF_Label aLabel2 = aShTool->AddShape(aShape2); + EXPECT_FALSE(aLabel2.FindAttribute(TDataStd_Name::GetID(), anAttr)) + << "Shape should not have a name attribute when AutoNaming is false"; + + // AutoNaming state will be automatically restored by the RAII guard +} diff --git a/src/Draw/TKQADraw/QABugs/QABugs_11.cxx b/src/Draw/TKQADraw/QABugs/QABugs_11.cxx index 66507011a0..9856cb0781 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_11.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_11.cxx @@ -1399,64 +1399,6 @@ static Standard_Integer OCC578(Draw_Interpretor& di, Standard_Integer argc, cons #include -//================================================================================================= - -static Standard_Integer OCC669(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 2) - { - di << "Usage : " << argv[0] << " GUID\n"; - return -1; - } - Standard_GUID guid(argv[1]); - // guid.ShallowDump(std::cout); - Standard_SStream aSStream; - guid.ShallowDump(aSStream); - di << aSStream; - di << "\n"; - return 0; -} - -#include - -//================================================================================================= - -static Standard_Integer OCC738_ShapeRef(Draw_Interpretor& di, - Standard_Integer argc, - const char** argv) -{ - if (argc != 1) - { - di << "Usage : " << argv[0] << "\n"; - return -1; - } - const Standard_GUID& guid = XCAFDoc::ShapeRefGUID(); - // guid.ShallowDump(std::cout); - Standard_SStream aSStream; - guid.ShallowDump(aSStream); - di << aSStream; - return 0; -} - -//================================================================================================= - -static Standard_Integer OCC738_Assembly(Draw_Interpretor& di, - Standard_Integer argc, - const char** argv) -{ - if (argc != 1) - { - di << "Usage : " << argv[0] << "\n"; - return -1; - } - const Standard_GUID& guid = XCAFDoc::AssemblyGUID(); - // guid.ShallowDump(std::cout); - Standard_SStream aSStream; - guid.ShallowDump(aSStream); - di << aSStream; - return 0; -} - #if defined(DDataStd_def01) #include @@ -1521,29 +1463,6 @@ static Standard_Integer OCC708(Draw_Interpretor& di, Standard_Integer argc, cons //================================================================================================= -#include - -static Standard_Integer OCC670(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 1) - { - di << "Usage : " << argv[0] << "\n"; - return -1; - } - - // check that exception initialized without message string can be safely handled and printed - try - { - throw Standard_OutOfRange(); - } - catch (Standard_Failure const& anException) - { - std::cout << "Caught successfully: "; - std::cout << anException << std::endl; - } - return 0; -} - #include //================================================================================================= @@ -1633,47 +1552,6 @@ static Standard_Integer OCC921(Draw_Interpretor& di, Standard_Integer argc, cons //================================================================================================= -static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char** argv) -{ - if (argc != 2) - { - di << "Usage : " << argv[0] << " expression\n"; - return 1; - } - - TCollection_AsciiString anExpStr(argv[1]); - anExpStr.AssignCat("*x"); - anExpStr.Prepend("Exp("); - anExpStr.AssignCat(")"); - - Handle(ExprIntrp_GenExp) exprIntrp = ExprIntrp_GenExp::Create(); - - // - // Create the expression - exprIntrp->Process(anExpStr); - - if (!exprIntrp->IsDone()) - { - di << "Interpretation of expression " << argv[1] << " failed\n"; - return 1; - } - - Handle(Expr_GeneralExpression) anExpr = exprIntrp->Expression(); - Handle(Expr_NamedUnknown) aVar = new Expr_NamedUnknown("x"); - Handle(Expr_GeneralExpression) newExpr = anExpr->Derivative(aVar); - - TCollection_AsciiString res = newExpr->String(); - Standard_CString resStr = res.ToCString(); - TCollection_AsciiString res_old = anExpr->String(); - Standard_CString res_oldStr = res_old.ToCString(); - - di << "X = " << argv[1] << "\n"; - di << "Y = " << res_oldStr << "\n"; - di << "Y' = " << resStr << "\n"; - - return 0; -} - #include #include @@ -4995,43 +4873,6 @@ Standard_Integer OCC28478(Draw_Interpretor& di, Standard_Integer argc, const cha return 0; } -Standard_Integer OCC31189(Draw_Interpretor& theDI, Standard_Integer /*argc*/, const char** /*argv*/) -{ - // redirect output of default messenger to DRAW (temporarily) - const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger(); - Message_SequenceOfPrinters aPrinters; - aPrinters.Append(aMsgMgr->ChangePrinters()); - aMsgMgr->AddPrinter(new Draw_Printer(theDI)); - - // scope block to test output of message on destruction of a stream buffer - { - Message_Messenger::StreamBuffer aSender = Message::SendInfo(); - - // check that messages output to sender and directly to messenger do not intermix - aSender << "Sender message 1: start ..."; - aMsgMgr->Send("Direct message 1"); - aSender << "... end" << std::endl; // endl should send the message - - // check that empty stream buffer does not produce output on destruction - Message::SendInfo(); - - // additional message to check that they go in expected order - aMsgMgr->Send("Direct message 2"); - - // check that empty stream buffer does produce empty line if std::endl is passed - Message::SendInfo() << std::endl; - - // last message should be sent on destruction of a sender - aSender << "Sender message 2"; - } - - // restore initial output queue - aMsgMgr->RemovePrinters(STANDARD_TYPE(Draw_Printer)); - aMsgMgr->ChangePrinters().Append(aPrinters); - - return 0; -} - namespace { struct Task @@ -5183,19 +5024,14 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) 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); - theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group); - theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group); theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group); - theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group); theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group); theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group); theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group); - theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group); theCommands.Add("OCC1029_AISTransparency", "OCC1029_AISTransparency (DOC, entry, [real])", @@ -5288,11 +5124,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) __FILE__, OCC28478, group); - theCommands.Add("OCC31189", - "OCC31189: check stream buffer interface of Message_Messenger", - __FILE__, - OCC31189, - group); theCommands.Add("OCC25748", "OCC25748 [-niter val] [-matsize val] [-progr] [-parallel]\n" "\t\ttest progress indicator in parallel execution", diff --git a/src/Draw/TKQADraw/QABugs/QABugs_17.cxx b/src/Draw/TKQADraw/QABugs/QABugs_17.cxx index 1a56be126a..112e0748b3 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_17.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_17.cxx @@ -393,87 +393,6 @@ static Standard_Integer OCC138(Draw_Interpretor& di, Standard_Integer /*argc*/, return 0; } -static int geom_get_2Dpt_from_3Dpt(const gp_Pnt& pnt3d, const gp_Pln& pln, gp_Pnt2d& pnt2d) -{ - int ret = 0; - Handle(Geom_Plane) gpln = new Geom_Plane(pln); - GeomAdaptor_Surface adsur(gpln); - Extrema_ExtPS extps(pnt3d, adsur, 0.001, 0.001); - if (extps.IsDone()) - { - int index; - for (index = 1; index <= extps.NbExt(); index++) - { - Extrema_POnSurf pons = extps.Point(index); - Standard_Real U, V; - pons.Parameter(U, V); - pnt2d.SetCoord(U, V); - ret = 1; - } - } - return ret; -} - -static Standard_Integer OCC353(Draw_Interpretor& di, Standard_Integer, const char**) -{ - gp_Ax2 ax21(gp_Pnt(100, 0, 0), gp_Dir(gp_Dir::D::Z)); - Handle(Geom_Circle) h_cir1 = new Geom_Circle(ax21, 25); - - gp_Ax2 ax22(gp_Pnt(-100, 0, 0), gp_Dir(gp_Dir::D::Z)); - Handle(Geom_Circle) h_cir2 = new Geom_Circle(ax22, 25); - - gp_Pln refpln(gp_Pnt(0, 0, 0), gp_Dir(gp_Dir::D::Z)); - Handle(Geom2d_Curve) cir2d1 = GeomAPI::To2d(h_cir1, refpln); - Handle(Geom2d_Curve) cir2d2 = GeomAPI::To2d(h_cir2, refpln); - - Geom2dAdaptor_Curve adop1(cir2d1); - Geom2dAdaptor_Curve adop2(cir2d2); - - Geom2dGcc_QualifiedCurve qcur1(adop1, GccEnt_enclosing); - Geom2dGcc_QualifiedCurve qcur2(adop2, GccEnt_enclosing); - - Handle(Geom_CartesianPoint) h_carpt = new Geom_CartesianPoint(0, 175, 0); - - gp_Pnt pt3d = h_carpt->Pnt(); - gp_Pnt2d pt2d; - geom_get_2Dpt_from_3Dpt(pt3d, refpln, pt2d); - - Standard_CString st; - st = "cir2d1"; - DrawTrSurf::Set(st, cir2d1); - st = "cir2d2"; - DrawTrSurf::Set(st, cir2d2); - st = "pt2d"; - DrawTrSurf::Set(st, pt2d); - - Handle(Geom2d_CartesianPoint) pt = new Geom2d_CartesianPoint(pt2d); - Geom2dGcc_Circ2d3Tan sol(qcur1, qcur2, pt, 0.001, 0.0, 0.0); - - int res = 0; - Standard_Character buf[10]; - buf[0] = '\0'; - - if (sol.IsDone()) - { - res = sol.NbSolutions(); - for (Standard_Integer i = 1; i <= res; i++) - { - Handle(Geom2d_Circle) aC = new Geom2d_Circle(sol.ThisSolution(i)); - Sprintf(buf, "Result_%d", i); - st = buf; - DrawTrSurf::Set(st, aC); - } - } - else - di << "\n Faulty: no solutions found "; - // printf("\n Faulty: no solutions found "); - - // printf("\n Num of solutions are %d ", res ); - di << "\n Num of solutions are " << res << " "; - - return 0; -} - static Standard_Integer OCC138LC(Draw_Interpretor& di, Standard_Integer /*argc*/, const char** argv) { Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); @@ -1438,7 +1357,6 @@ void QABugs::Commands_17(Draw_Interpretor& theCommands) theCommands.Add("BUC60970", "BUC60970 shape result", __FILE__, BUC60970, group); theCommands.Add("BUC60915", "BUC60915", __FILE__, BUC60915_1, group); theCommands.Add("OCC138", "OCC138", __FILE__, OCC138, group); - theCommands.Add("OCC353", "OCC353", __FILE__, OCC353, group); theCommands.Add("OCC138LC", "OCC138LC", __FILE__, OCC138LC, group); theCommands.Add("OCC566", "OCC566 shape [ xmin ymin zmin xmax ymax zmax] ; print bounding box", diff --git a/src/Draw/TKQADraw/QABugs/QABugs_19.cxx b/src/Draw/TKQADraw/QABugs/QABugs_19.cxx index 67f637b4c3..c729a6d8f2 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_19.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_19.cxx @@ -85,6 +85,7 @@ Standard_DISABLE_DEPRECATION_WARNINGS #include #include #include +#include #define QCOMPARE(val1, val2) \ di << "Checking " #val1 " == " #val2 << ((val1) == (val2) ? ": OK\n" : ": Error\n") @@ -134,40 +135,6 @@ static Standard_Integer OCC230(Draw_Interpretor& di, Standard_Integer argc, cons return 0; } -static Standard_Integer OCC23595(Draw_Interpretor& di, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - Handle(TDocStd_Application) anApp = DDocStd::GetApplication(); - Handle(TDocStd_Document) aDoc; - anApp->NewDocument("XmlXCAF", aDoc); - QCOMPARE(!aDoc.IsNull(), Standard_True); - - Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main()); - - // check default value - Standard_Boolean aValue = XCAFDoc_ShapeTool::AutoNaming(); - QCOMPARE(aValue, Standard_True); - - // true - XCAFDoc_ShapeTool::SetAutoNaming(Standard_True); - TopoDS_Shape aShape = BRepPrimAPI_MakeBox(100., 200., 300.).Shape(); - TDF_Label aLabel = aShTool->AddShape(aShape); - Handle(TDataStd_Name) anAttr; - QCOMPARE(aLabel.FindAttribute(TDataStd_Name::GetID(), anAttr), Standard_True); - - // false - XCAFDoc_ShapeTool::SetAutoNaming(Standard_False); - aShape = BRepPrimAPI_MakeBox(300., 200., 100.).Shape(); - aLabel = aShTool->AddShape(aShape); - QCOMPARE(!aLabel.FindAttribute(TDataStd_Name::GetID(), anAttr), Standard_True); - - // restore - XCAFDoc_ShapeTool::SetAutoNaming(aValue); - - return 0; -} - #include Standard_Integer OCC22611(Draw_Interpretor& di, Standard_Integer argc, const char** argv) @@ -1199,42 +1166,6 @@ static Standard_Integer OCC24931(Draw_Interpretor& di, Standard_Integer argc, co return 0; } -#include - -//================================================================================================= - -static Standard_Integer OCC24755(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(); - // Prepend an int value. - TDataStd_Integer::Set(aLab, 0); - // Prepend a name. - TDataStd_Name::Set(aLab, "test"); - // Append a double value. - aLab.AddAttribute(new TDataStd_Real(), true /*append*/); - - TDF_AttributeIterator i(aLab); - Handle(TDF_Attribute) anAttr = i.Value(); - QCOMPARE(anAttr->IsKind(STANDARD_TYPE(TDataStd_Integer)), Standard_True); - i.Next(); - anAttr = i.Value(); - QCOMPARE(anAttr->IsKind(STANDARD_TYPE(TDataStd_Name)), Standard_True); - i.Next(); - anAttr = i.Value(); - QCOMPARE(anAttr->IsKind(STANDARD_TYPE(TDataStd_Real)), Standard_True); - - return 0; -} - struct MyStubObject { MyStubObject() @@ -1314,50 +1245,6 @@ static Standard_Integer OCC24834(Draw_Interpretor& di, Standard_Integer n, const return 0; } -#include -#include - -//================================================================================================= - -static Standard_Integer OCC24889(Draw_Interpretor& theDI, - Standard_Integer /*theNArg*/, - const char** /*theArgs*/) -{ - // Curves - Handle(Geom2d_Circle) aCircle1 = - new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(25, -25), gp_Dir2d(gp_Dir2d::D::X), gp_Dir2d(-0, 1)), 155); - - Handle(Geom2d_Circle) aCircle2 = - new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(25, 25), gp_Dir2d(gp_Dir2d::D::X), gp_Dir2d(-0, 1)), 155); - - Handle(Geom2d_TrimmedCurve) aTrim[2] = { - new Geom2d_TrimmedCurve(aCircle1, 1.57079632679490, 2.97959469729228), - new Geom2d_TrimmedCurve(aCircle2, 3.30359060633978, 4.71238898038469)}; - - DrawTrSurf::Set("c_1", aTrim[0]); - DrawTrSurf::Set("c_2", aTrim[1]); - - // Intersection - constexpr Standard_Real aTol = Precision::Confusion(); - Geom2dAPI_InterCurveCurve aIntTool(aTrim[0], aTrim[1], aTol); - - const IntRes2d_IntersectionPoint& aIntPnt = aIntTool.Intersector().Point(1); - - gp_Pnt2d aIntRes = aIntTool.Point(1); - Standard_Real aPar[2] = {aIntPnt.ParamOnFirst(), aIntPnt.ParamOnSecond()}; - - // theDI.precision( 5 ); - theDI << "Int point: X = " << aIntRes.X() << "; Y = " << aIntRes.Y() << "\n"; - for (int i = 0; i < 2; ++i) - { - theDI << "Curve " << i << ": FirstParam = " << aTrim[i]->FirstParameter() - << "; LastParam = " << aTrim[i]->LastParameter() << "; IntParameter = " << aPar[i] - << "\n"; - } - - return 0; -} - #include #include @@ -2187,25 +2074,6 @@ static Standard_Integer OCC25100(Draw_Interpretor& di, Standard_Integer argc, co return 0; } -//================================================================================================= - -static Standard_Integer OCC25348(Draw_Interpretor& theDI, - Standard_Integer /*theArgNb*/, - const char** /*theArgVec*/) -{ - Handle(NCollection_IncAllocator) anAlloc1; - NCollection_List aList1(anAlloc1); - for (int i = 0; i < 10; i++) - { - Handle(NCollection_IncAllocator) anAlloc2; - NCollection_List aList2(anAlloc2); - aList2.Append(i); - aList1.Assign(aList2); - } - theDI << "Test complete\n"; - return 0; -} - #include #include @@ -2372,149 +2240,6 @@ static Standard_Integer OCC25446(Draw_Interpretor& theDI, Standard_Integer argc, return 0; } -//==================================================== -// Auxiliary functor class for the command OCC25545; -// it gets access to a vertex with the given index and -// checks that X coordinate of the point is equal to index; -// if it is not so then a data race is reported. -//==================================================== -struct OCC25545_Functor -{ - OCC25545_Functor(const std::vector& theShapeVec) - : myShapeVec(&theShapeVec), - myIsRaceDetected(0) - { - } - - void operator()(size_t i) const - { - if (!myIsRaceDetected) - { - const TopoDS_Vertex& aV = TopoDS::Vertex(myShapeVec->at(i)); - gp_Pnt aP = BRep_Tool::Pnt(aV); - if (aP.X() != static_cast(i)) - { - ++myIsRaceDetected; - } - } - } - - const std::vector* myShapeVec; - mutable std::atomic myIsRaceDetected; -}; - -//======================================================================= -// function : OCC25545 -// purpose : Tests data race when concurrently accessing TopLoc_Location::Transformation() -//======================================================================= - -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. - Standard_Integer n = 1000; - std::vector aShapeVec(n); - std::vector aLocVec(n); - TopoDS_Shape aShape = BRepBuilderAPI_MakeVertex(gp::Origin()); - aShapeVec[0] = aShape; - for (Standard_Integer i = 1; i < n; ++i) - { - gp_Trsf aT; - aT.SetTranslation(gp_Vec(1, 0, 0)); - aLocVec[i] = aLocVec[i - 1] * aT; - aShapeVec[i] = aShape.Moved(aLocVec[i]); - } - - // Evaluator function will access vertices geometry - // concurrently - OCC25545_Functor aFunc(aShapeVec); - - // concurrently process - OSD_Parallel::For(0, n, aFunc); - - QVERIFY(!aFunc.myIsRaceDetected); - return 0; -} - -//================================================================================================= - -#include -#include -#include -#include -#include - -static Standard_Integer OCC25547(Draw_Interpretor& theDI, - Standard_Integer /*argc*/, - const char** /*argv*/) -{ - // The general aim of this test is to prevent linkage errors due to missed - // Standard_EXPORT attribute for static methods. - - // However, start checking the main functionality at first. - const Standard_Real aFirstP = 0., aLastP = M_PI; - Handle(Geom_Circle) aCircle = new Geom_Circle(gp_Ax2(gp::Origin(), gp::DZ()), 10); - Handle(Geom_TrimmedCurve) aHalf = new Geom_TrimmedCurve(aCircle, aFirstP, aLastP); - TopoDS_Edge aEdge = BRepBuilderAPI_MakeEdge(aHalf); - BRepAdaptor_Curve aAdaptor(aEdge); - BRepMesh_GeomTool aGeomTool(aAdaptor, aFirstP, aLastP, 0.1, 0.5); - - if (aGeomTool.NbPoints() == 0) - { - theDI << "Error. BRepMesh_GeomTool failed to discretize an arc.\n"; - return 1; - } - - // Test static methods. - TopoDS_Face aFace = BRepBuilderAPI_MakeFace(gp_Pln(gp::Origin(), gp::DZ())); - BRepAdaptor_Surface aSurf(aFace); - Handle(BRepAdaptor_Surface) aHSurf = new BRepAdaptor_Surface(aSurf); - - gp_Pnt aPnt; - gp_Dir aNormal; - if (!BRepMesh_GeomTool::Normal(aHSurf, 10., 10., aPnt, aNormal)) - { - theDI << "Error. BRepMesh_GeomTool failed to take a normal of surface.\n"; - return 1; - } - - gp_XY aRefPnts[4] = {gp_XY(-10., -10.), gp_XY(10., 10.), gp_XY(-10., 10.), gp_XY(10., -10.)}; - - gp_Pnt2d aIntPnt; - Standard_Real aParams[2]; - BRepMesh_GeomTool::IntFlag aIntFlag = BRepMesh_GeomTool::IntLinLin(aRefPnts[0], - aRefPnts[1], - aRefPnts[2], - aRefPnts[3], - aIntPnt.ChangeCoord(), - aParams); - - Standard_Real aDiff = aIntPnt.Distance(gp::Origin2d()); - if (aIntFlag != BRepMesh_GeomTool::Cross || aDiff > Precision::PConfusion()) - { - theDI << "Error. BRepMesh_GeomTool failed to intersect two lines.\n"; - return 1; - } - - aIntFlag = BRepMesh_GeomTool::IntSegSeg(aRefPnts[0], - aRefPnts[1], - aRefPnts[2], - aRefPnts[3], - Standard_False, - Standard_False, - aIntPnt); - - aDiff = aIntPnt.Distance(gp::Origin2d()); - if (aIntFlag != BRepMesh_GeomTool::Cross || aDiff > Precision::PConfusion()) - { - theDI << "Error. BRepMesh_GeomTool failed to intersect two segments.\n"; - return 1; - } - - theDI << "Test complete\n"; - return 0; -} - static Standard_Integer OCC26139(Draw_Interpretor& theDI, Standard_Integer argc, const char** argv) { @@ -3233,24 +2958,9 @@ Standard_Integer OCC26446(Draw_Interpretor& di, Standard_Integer n, const char** return 0; } -static Standard_Integer OCC26448(Draw_Interpretor& theDI, Standard_Integer, const char**) -{ - TColStd_SequenceOfReal aSeq1, aSeq2; - aSeq1.Append(11.); - aSeq1.Prepend(aSeq2); - theDI << "TCollection: 11 -> " << aSeq1.First() << "\n"; - - NCollection_Sequence nSeq1, nSeq2; - nSeq1.Append(11.); - nSeq1.Prepend(nSeq2); - theDI << "NCollection: 11 -> " << nSeq1.First() << "\n"; - - theDI << "OK"; - return 0; -} - //================================================================================================= +#include #include #include @@ -3970,7 +3680,6 @@ static Standard_Integer OCC24537(Draw_Interpretor& theDI, Standard_Integer argc, } #include -#include static TopoDS_Shape taper(const TopoDS_Shape& shape, const TopoDS_Face& face_a, @@ -4581,75 +4290,6 @@ static Standard_Integer OCC29412(Draw_Interpretor& /*theDI*/, return 0; } -#include -#include - -//======================================================================= -// function : OCC30492 -// purpose : BFGS and FRPR fail if starting point is exactly the minimum. -//======================================================================= -// Function is: -// f(x) = x^2 -class SquareFunction : public math_MultipleVarFunctionWithGradient -{ -public: - SquareFunction() {} - - virtual Standard_Integer NbVariables() const { return 1; } - - virtual Standard_Boolean Value(const math_Vector& X, Standard_Real& F) - { - const Standard_Real x = X(1); - F = x * x; - - return Standard_True; - } - - virtual Standard_Boolean Gradient(const math_Vector& X, math_Vector& G) - { - const Standard_Real x = X(1); - G(1) = 2 * x; - - return Standard_True; - } - - virtual Standard_Boolean Values(const math_Vector& X, Standard_Real& F, math_Vector& G) - { - Value(X, F); - Gradient(X, G); - - return Standard_True; - } - -private: -}; - -static Standard_Integer OCC30492(Draw_Interpretor& /*theDI*/, - Standard_Integer /*theNArg*/, - const char** /*theArgs*/) -{ - SquareFunction aFunc; - math_Vector aStartPnt(1, 1); - aStartPnt(1) = 0.0; - - // BFGS and FRPR fail when if starting point is exactly the minimum. - math_FRPR aFRPR(aFunc, Precision::Confusion()); - aFRPR.Perform(aFunc, aStartPnt); - if (!aFRPR.IsDone()) - std::cout << "OCC30492: Error: FRPR optimization is not done." << std::endl; - else - std::cout << "OCC30492: OK: FRPR optimization is done." << std::endl; - - math_BFGS aBFGS(1, Precision::Confusion()); - aBFGS.Perform(aFunc, aStartPnt); - if (!aBFGS.IsDone()) - std::cout << "OCC30492: Error: BFGS optimization is not done." << std::endl; - else - std::cout << "OCC30492: OK: BFGS optimization is done." << std::endl; - - return 0; -} - //================================================================================================= void QABugs::Commands_19(Draw_Interpretor& theCommands) @@ -4672,7 +4312,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) group); theCommands.Add("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group); - theCommands.Add("OCC23595", "OCC23595", __FILE__, OCC23595, group); theCommands.Add("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group); theCommands.Add("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group); theCommands.Add("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group); @@ -4700,9 +4339,7 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) __FILE__, OCC24667, group); - theCommands.Add("OCC24755", "OCC24755", __FILE__, OCC24755, group); theCommands.Add("OCC24834", "OCC24834", __FILE__, OCC24834, group); - theCommands.Add("OCC24889", "OCC24889", __FILE__, OCC24889, group); theCommands.Add("OCC23951", "OCC23951 path to saved step file", __FILE__, OCC23951, group); theCommands.Add("OCC24931", "OCC24931 path to saved xml file", __FILE__, OCC24931, group); theCommands.Add("OCC23950", "OCC23950 step_file", __FILE__, OCC23950, group); @@ -4739,16 +4376,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) theCommands.Add("OCC7570", "OCC7570 shape", __FILE__, OCC7570, group); theCommands.Add("OCC25100", "OCC25100 shape", __FILE__, OCC25100, group); theCommands.Add("OCC25340", "OCC25340", __FILE__, OCC25340, group); - theCommands.Add("OCC25348", "OCC25348", __FILE__, OCC25348, group); theCommands.Add("OCC25413", "OCC25413 shape", __FILE__, OCC25413, group); theCommands.Add("OCC25446", "OCC25446 res b1 b2 op", __FILE__, OCC25446, group); - theCommands.Add("OCC25545", - "no args; tests data race when concurrently accessing \n" - "\t\tTopLoc_Location::Transformation()", - __FILE__, - OCC25545, - group); - theCommands.Add("OCC25547", "OCC25547", __FILE__, OCC25547, group); theCommands.Add("OCC24881", "OCC24881 shape", __FILE__, OCC24881, group); theCommands.Add("xprojponf", "xprojponf p f", __FILE__, xprojponf, group); theCommands.Add("OCC24923", "OCC24923", __FILE__, OCC24923, group); @@ -4759,11 +4388,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) group); theCommands.Add("OCC26284", "OCC26284", __FILE__, OCC26284, group); theCommands.Add("OCC26446", "OCC26446 r c1 c2", __FILE__, OCC26446, group); - theCommands.Add("OCC26448", - "OCC26448: check method Prepend() of sequence", - __FILE__, - OCC26448, - group); theCommands.Add("OCC26407", "OCC26407 result_name", __FILE__, OCC26407, group); theCommands.Add("OCC26485", "OCC26485 shape", __FILE__, OCC26485, group); theCommands.Add("OCC26553", "OCC26553 file_path", __FILE__, OCC26553, group); @@ -4842,11 +4466,5 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) __FILE__, OCC29412, group); - theCommands.Add( - "OCC30492", - "OCC30492: Checks whether BFGS and FRPR fail when starting point is exact minimum.", - __FILE__, - OCC30492, - group); return; } diff --git a/src/Draw/TKQADraw/QABugs/QABugs_20.cxx b/src/Draw/TKQADraw/QABugs/QABugs_20.cxx index c1c1fcb64d..57dce3f526 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_20.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_20.cxx @@ -1862,82 +1862,6 @@ static Standard_Integer SurfaceGenOCC26675_1(Draw_Interpretor& theDI, return 0; } -namespace AllocTest -{ -// The test is based of occupying of all available virtual memory. -// Obviously it has no sense on 64-bit platforms. - -enum AllocTestStatus -{ - NotApplicable = 0x1, - OUMCatchOK = 0x2, - OUMCatchFail = 0x4 -}; - -template -int test() -{ - // non-32-bit implementation - return NotApplicable; -} - -template <> -int test<4>() -{ - // 32-bit implementation - NCollection_List aList; - const Standard_Integer aBlockSizes[] = {100000, 10000, 10}; - int aStatus = 0; - - // start populate memory with blocks of large size, then - // smaller ones and so on according to content of the array aBlockSizes - for (size_t i = 0; i < sizeof(aBlockSizes) / sizeof(int); i++) - { - try - { - for (;;) - aList.Append(Standard::Allocate(aBlockSizes[i])); - } - catch (Standard_Failure const&) - { - aStatus |= OUMCatchOK; - } - catch (...) - { - aStatus |= OUMCatchFail; - break; - } - } - // release all allocated blocks - for (NCollection_List::Iterator it(aList); it.More(); it.Next()) - { - Standard::Free(it.Value()); - } - return aStatus; -} -} // namespace AllocTest - -//================================================================================================= - -static Standard_Integer OCC24836(Draw_Interpretor& theDI, Standard_Integer n, const char** a) -{ - if (n != 1) - { - theDI << "Usage : " << a[0] << "\n"; - return 1; - } - - int aStatus = AllocTest::test(); - - if (aStatus & AllocTest::NotApplicable) - theDI << "This test case is not applicable for 64-bit and higher platforms\n"; - if (aStatus & AllocTest::OUMCatchOK) - theDI << "out-of-memory has been caught: OK\n"; - if (aStatus & AllocTest::OUMCatchFail) - theDI << "Error: out-of-memory is not always caught\n"; - return 0; -} - //======================================================================= // function : OCC27021 // purpose : Tests performance of obtaining geometry (points) via topological @@ -2482,51 +2406,6 @@ static Standard_Integer OCC26747_3(Draw_Interpretor& theDI, #include "Geom2d_BezierCurve.hxx" #include "Geom2dGcc_QualifiedCurve.hxx" #include "Geom2dAdaptor_Curve.hxx" -#include "Geom2dAPI_ProjectPointOnCurve.hxx" -#include "Geom2dGcc_Circ2d2TanOn.hxx" - -//================================================================================================= - -static Standard_Integer OCC27357(Draw_Interpretor& theDI, Standard_Integer, const char**) -{ - TColgp_Array1OfPnt2d aPoles(1, 3); - aPoles.SetValue(1, gp_Pnt2d(0., 0.)); - aPoles.SetValue(2, gp_Pnt2d(0., 1.)); - aPoles.SetValue(3, gp_Pnt2d(6., 0.)); - - Handle(Geom2d_BezierCurve) aCurve1 = new Geom2d_BezierCurve(aPoles); - aPoles.SetValue(2, gp_Pnt2d(0., 1.5)); - Handle(Geom2d_BezierCurve) aCurve2 = new Geom2d_BezierCurve(aPoles); - NCollection_List aDuumyList; - int nP = 100; - for (int i = 0; i < nP; i++) - { - Standard_Real u = i / (nP - 1.); - gp_Pnt2d aP1; - gp_Vec2d aTangent; - aCurve1->D1(u, aP1, aTangent); - gp_Vec2d aNormal(-aTangent.Y(), aTangent.X()); - Handle(Geom2d_Line) normalLine = new Geom2d_Line(aP1, gp_Dir2d(aNormal)); - Geom2dGcc_QualifiedCurve qualifiedC1(Geom2dAdaptor_Curve(aCurve1), GccEnt_unqualified); - Geom2dGcc_QualifiedCurve qualifiedC2(Geom2dAdaptor_Curve(aCurve2), GccEnt_unqualified); - - try - { - Geom2dAPI_ProjectPointOnCurve projPc1(aP1, aCurve1); - double g1 = projPc1.LowerDistanceParameter(); - Geom2dAPI_ProjectPointOnCurve projPc3(aP1, normalLine); - double g3 = projPc3.LowerDistanceParameter(); - Geom2dGcc_Circ2d2TanOn - aCircleBuilder(qualifiedC1, qualifiedC2, Geom2dAdaptor_Curve(normalLine), 1e-9, g1, g1, g3); - aDuumyList.Append(aCircleBuilder.NbSolutions()); - } - catch (Standard_Failure const&) - { - theDI << "Exception was caught\n"; - } - } - return 0; -} #include #include @@ -2578,40 +2457,6 @@ static Standard_Integer OCC26270(Draw_Interpretor& theDI, return 0; } -#include "BRepBuilderAPI_MakeWire.hxx" -#include "BRepBuilderAPI_MakeEdge.hxx" - -static Standard_Integer OCC27552(Draw_Interpretor&, Standard_Integer, const char**) -{ - BRep_Builder BB; - TopoDS_Vertex V1, V2, V3; - TopoDS_Edge E1, E2; - BB.MakeVertex(V1, gp_Pnt(0, 0, 0), 0.1); - BB.MakeVertex(V2, gp_Pnt(5, 0, 0), 0.1); - BB.MakeVertex(V3, gp_Pnt(10, 0, 0), 0.1); - E1 = BRepBuilderAPI_MakeEdge(V1, V2).Edge(); - E2 = BRepBuilderAPI_MakeEdge(V2, V3).Edge(); - BRepBuilderAPI_MakeWire MW; - MW.Add(E1); - MW.Add(E2); - TopoDS_Vertex V4, V5, V6, V7; - TopoDS_Edge E3, E4; - BB.MakeVertex(V4, gp_Pnt(10, 0 + 0.05, 0), 0.07); - BB.MakeVertex(V5, gp_Pnt(10, 0 - 0.05, 0), 0.07); - BB.MakeVertex(V6, gp_Pnt(10, 0 + 2, 0), 0.07); - BB.MakeVertex(V7, gp_Pnt(10, 0 - 2, 0), 0.07); - E3 = BRepBuilderAPI_MakeEdge(V4, V6).Edge(); - E4 = BRepBuilderAPI_MakeEdge(V5, V7).Edge(); - TopTools_ListOfShape LLE; - LLE.Append(E3); - LLE.Append(E4); - MW.Add(LLE); - TopoDS_Shape W = MW.Wire(); - DBRep::Set("outw", W); - - return 0; -} - #include static Standard_Integer OCC27875(Draw_Interpretor& theDI, @@ -2639,6 +2484,8 @@ static Standard_Integer OCC27875(Draw_Interpretor& theDI, return 0; } +#include +#include #include static Standard_Integer OCC27884(Draw_Interpretor& theDI, @@ -3917,38 +3764,6 @@ static Standard_Integer OCC30880(Draw_Interpretor& theDI, #include -static Standard_Integer OCC30704(Draw_Interpretor& di, Standard_Integer, const char**) -{ - // Make a shape somewhere far from (0, 0, 0). - BRepPrimAPI_MakeBox mkBox(gp_Pnt(100, 100, 100), 100, 100, 100); - const TopoDS_Shape& box = mkBox.Shape(); - - // Add a bounding box of a shape to a void bounding box. - Bnd_OBB aVoidBox, aBox; - BRepBndLib::AddOBB(box, aBox, Standard_False, Standard_False, Standard_False); - aVoidBox.Add(aBox); - - // Print the center point of the bounding box. - const gp_XYZ& center = aVoidBox.Center(); - di << center.X() << " " << center.Y() << " " << center.Z(); - return 0; -} - -static Standard_Integer OCC30704_1(Draw_Interpretor& di, Standard_Integer, const char**) -{ - // A point. - gp_Pnt aP(100, 200, 300); - - // Add the point to a void bounding box. - Bnd_OBB aVoidBox; - aVoidBox.Add(aP); - - // Print the center point of the bounding box. - const gp_XYZ& center = aVoidBox.Center(); - di << center.X() << " " << center.Y() << " " << center.Z(); - return 0; -} - //======================================================================= // function : OCC30990 // purpose : check consistency of implementation of cache in B-Spline surfaces @@ -4059,31 +3874,6 @@ static Standard_Integer OCC30990(Draw_Interpretor& theDI, return 0; } -//======================================================================= -// function : OCC31294 -// purpose : check list of shapes generated from shape, which is not any subshape -// of input shape for prism algorithm -//======================================================================= -#include -#include - -static Standard_Integer OCC31294(Draw_Interpretor& di, Standard_Integer, const char**) -{ - BRepBuilderAPI_MakeVertex mkVert(gp_Pnt(0., 0., 0.)); - BRepBuilderAPI_MakeVertex mkDummy(gp_Pnt(0., 0., 0.)); - BRepPrimAPI_MakePrism mkPrism(mkVert.Shape(), gp_Vec(0., 0., 1.)); - - Standard_Integer nbgen = mkPrism.Generated(mkVert.Shape()).Extent(); - Standard_Integer nbdummy = mkPrism.Generated(mkDummy.Shape()).Extent(); - - if (nbgen != 1 || nbdummy != 0) - { - di << "Error: wrong generated list \n"; - } - - return 0; -} - #include #include #include @@ -4672,7 +4462,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) const char* group = "QABugs"; theCommands.Add("OCC26675_1", "OCC26675_1 result", __FILE__, SurfaceGenOCC26675_1, group); - theCommands.Add("OCC24836", "OCC24836", __FILE__, OCC24836, group); theCommands.Add("OCC27021", "OCC27021", __FILE__, OCC27021, group); theCommands.Add("OCC27235", "OCC27235", __FILE__, OCC27235, group); theCommands.Add("OCC26930", "OCC26930", __FILE__, OCC26930, group); @@ -4680,9 +4469,7 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) theCommands.Add("OCC26747_1", "OCC26747_1 result", __FILE__, OCC26747_1, group); theCommands.Add("OCC26747_2", "OCC26747_2 result", __FILE__, OCC26747_2, group); theCommands.Add("OCC26747_3", "OCC26747_3 result", __FILE__, OCC26747_3, group); - theCommands.Add("OCC27357", "OCC27357", __FILE__, OCC27357, group); theCommands.Add("OCC26270", "OCC26270 shape result", __FILE__, OCC26270, group); - theCommands.Add("OCC27552", "OCC27552", __FILE__, OCC27552, group); theCommands.Add("OCC27875", "OCC27875 curve", __FILE__, OCC27875, group); theCommands.Add("OCC27884", "OCC27884: Possible improvement for 2d classifier", @@ -4755,10 +4542,6 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) OCC30880, group); - theCommands.Add("OCC30704", "OCC30704", __FILE__, OCC30704, group); - theCommands.Add("OCC30704_1", "OCC30704_1", __FILE__, OCC30704_1, group); - theCommands.Add("OCC31294", "OCC31294", __FILE__, OCC31294, group); - theCommands.Add("OCC31697", "OCC31697 expression variable", __FILE__, OCC31697, group); theCommands.Add( diff --git a/src/FoundationClasses/TKMath/GTests/Bnd_OBB_Test.cxx b/src/FoundationClasses/TKMath/GTests/Bnd_OBB_Test.cxx index 773f129801..2f0f50fb07 100644 --- a/src/FoundationClasses/TKMath/GTests/Bnd_OBB_Test.cxx +++ b/src/FoundationClasses/TKMath/GTests/Bnd_OBB_Test.cxx @@ -12,6 +12,8 @@ // commercial license or contractual agreement. #include +#include +#include #include #include @@ -31,3 +33,47 @@ TEST(Bnd_OBB_Test, OCC33009_ReBuildWithPoints) // Should not throw exception when rebuilding with points EXPECT_NO_THROW(aBndBox.ReBuild(aPoints, (const TColStd_Array1OfReal*)0, true)); } + +TEST(Bnd_OBB_Test, OCC30704_AddBoundingBoxToVoidBox) +{ + // Bug OCC30704: Oriented bounding box (Bnd_OBB) gives a wrong result + // if a box is added to a void box + // This test verifies that adding a bounding box to a void bounding box + // correctly sets the center of the void box + + // Make a shape somewhere far from (0, 0, 0) + BRepPrimAPI_MakeBox aMkBox(gp_Pnt(100, 100, 100), 100, 100, 100); + const TopoDS_Shape& aBox = aMkBox.Shape(); + + // Add a bounding box of a shape to a void bounding box + Bnd_OBB aVoidBox, aOBB; + BRepBndLib::AddOBB(aBox, aOBB, Standard_False, Standard_False, Standard_False); + aVoidBox.Add(aOBB); + + // Check the center point of the bounding box + const gp_XYZ& aCenter = aVoidBox.Center(); + EXPECT_DOUBLE_EQ(aCenter.X(), 150.0); + EXPECT_DOUBLE_EQ(aCenter.Y(), 150.0); + EXPECT_DOUBLE_EQ(aCenter.Z(), 150.0); +} + +TEST(Bnd_OBB_Test, OCC30704_AddPointToVoidBox) +{ + // Bug OCC30704: Oriented bounding box (Bnd_OBB) gives a wrong result + // if a point is added to a void box + // This test verifies that adding a point to a void bounding box + // correctly sets the center of the void box to that point + + // A point + gp_Pnt aP(100, 200, 300); + + // Add the point to a void bounding box + Bnd_OBB aVoidBox; + aVoidBox.Add(aP); + + // Check the center point of the bounding box + const gp_XYZ& aCenter = aVoidBox.Center(); + EXPECT_DOUBLE_EQ(aCenter.X(), 100.0); + EXPECT_DOUBLE_EQ(aCenter.Y(), 200.0); + EXPECT_DOUBLE_EQ(aCenter.Z(), 300.0); +} diff --git a/src/FoundationClasses/TKMath/GTests/math_BFGS_Test.cxx b/src/FoundationClasses/TKMath/GTests/math_BFGS_Test.cxx index 786ff138be..56ea6ac25c 100644 --- a/src/FoundationClasses/TKMath/GTests/math_BFGS_Test.cxx +++ b/src/FoundationClasses/TKMath/GTests/math_BFGS_Test.cxx @@ -12,6 +12,7 @@ // commercial license or contractual agreement. #include +#include #include #include @@ -474,4 +475,72 @@ TEST(MathBFGSTest, MultipleOptimizations) EXPECT_NEAR(anOptimizer.Location()(1), 1.0, 1.0e-6) << "Each should find correct X minimum"; EXPECT_NEAR(anOptimizer.Location()(2), 2.0, 1.0e-6) << "Each should find correct Y minimum"; } +} + +// Simple 1D square function: f(x) = x^2 (minimum at x=0, value = 0) +class SquareFunction1D : public math_MultipleVarFunctionWithGradient +{ +public: + SquareFunction1D() {} + + Standard_Integer NbVariables() const override { return 1; } + + Standard_Boolean Value(const math_Vector& theX, Standard_Real& theF) override + { + if (theX.Length() != 1) + return Standard_False; + const Standard_Real x = theX(1); + theF = x * x; + return Standard_True; + } + + Standard_Boolean Gradient(const math_Vector& theX, math_Vector& theG) override + { + if (theX.Length() != 1 || theG.Length() != 1) + return Standard_False; + const Standard_Real x = theX(1); + theG(1) = 2.0 * x; + return Standard_True; + } + + Standard_Boolean Values(const math_Vector& theX, Standard_Real& theF, math_Vector& theG) override + { + return Value(theX, theF) && Gradient(theX, theG); + } +}; + +TEST(MathBFGSTest, OCC30492_StartingPointAtMinimum) +{ + // Bug OCC30492: BFGS and FRPR fail if starting point is exactly the minimum + // Test that both BFGS and FRPR work correctly when the starting point is at the minimum + SquareFunction1D aFunc; + math_Vector aStartPnt(1, 1); + aStartPnt(1) = 0.0; // Start exactly at the minimum + + // Test FRPR + math_FRPR aFRPR(aFunc, Precision::Confusion()); + aFRPR.Perform(aFunc, aStartPnt); + EXPECT_TRUE(aFRPR.IsDone()) << "FRPR optimization should succeed when starting at minimum"; + + // Test BFGS + math_BFGS aBFGS(1, Precision::Confusion()); + aBFGS.Perform(aFunc, aStartPnt); + EXPECT_TRUE(aBFGS.IsDone()) << "BFGS optimization should succeed when starting at minimum"; + + // Verify that both found the minimum (or stayed at it) + if (aFRPR.IsDone()) + { + EXPECT_NEAR(aFRPR.Location()(1), 0.0, Precision::Confusion()) + << "FRPR should stay at/find the minimum"; + EXPECT_NEAR(aFRPR.Minimum(), 0.0, Precision::Confusion()) + << "FRPR should report minimum value of 0"; + } + + if (aBFGS.IsDone()) + { + EXPECT_NEAR(aBFGS.Location()(1), 0.0, Precision::Confusion()) + << "BFGS should stay at/find the minimum"; + EXPECT_NEAR(aBFGS.Minimum(), 0.0, Precision::Confusion()) + << "BFGS should report minimum value of 0"; + } } \ No newline at end of file diff --git a/src/FoundationClasses/TKernel/GTests/FILES.cmake b/src/FoundationClasses/TKernel/GTests/FILES.cmake index 77a983dc8e..582fc9d16b 100644 --- a/src/FoundationClasses/TKernel/GTests/FILES.cmake +++ b/src/FoundationClasses/TKernel/GTests/FILES.cmake @@ -4,6 +4,7 @@ set(OCCT_TKernel_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKernel_GTests_FILES Handle_Advanced_Test.cxx Handle_Operations_Test.cxx + Message_Messenger_Test.cxx NCollection_Array1_Test.cxx NCollection_Array2_Test.cxx NCollection_BaseAllocator_Test.cxx @@ -25,8 +26,11 @@ set(OCCT_TKernel_GTests_FILES Standard_Atomic_Test.cxx Standard_Character_Test.cxx Standard_Dump_Test.cxx + Standard_Failure_Test.cxx + Standard_GUID_Test.cxx Standard_Handle_Test.cxx TCollection_AsciiString_Test.cxx TCollection_ExtendedString_Test.cxx + TopLoc_Location_Test.cxx UnitsAPI_Test.cxx ) diff --git a/src/FoundationClasses/TKernel/GTests/Message_Messenger_Test.cxx b/src/FoundationClasses/TKernel/GTests/Message_Messenger_Test.cxx new file mode 100644 index 0000000000..c516b68172 --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/Message_Messenger_Test.cxx @@ -0,0 +1,143 @@ +// 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 + +namespace +{ +//! Custom message printer that collects messages into a string stream +class TestMessagePrinter : public Message_Printer +{ +public: + TestMessagePrinter(std::ostringstream& theStream) + : myStream(theStream) + { + } + + virtual void send(const TCollection_AsciiString& theString, + const Message_Gravity theGravity) const override + { + if (theGravity >= Message_Info) + { + myStream << theString << "\n"; + } + } + +private: + std::ostringstream& myStream; +}; +} // namespace + +TEST(Message_Messenger_Test, OCC31189_StreamBufferMessageOrdering) +{ + // Bug OCC31189: Test consistency of messages output using stream buffer interface + // Verify that messages sent via stream buffers and directly to messenger don't intermix + + std::ostringstream anOutput; + Handle(TestMessagePrinter) aPrinter = new TestMessagePrinter(anOutput); + const Handle(Message_Messenger)& aMsgMgr = ::Message::DefaultMessenger(); + + // Save original printers + Message_SequenceOfPrinters anOriginalPrinters; + anOriginalPrinters.Append(aMsgMgr->ChangePrinters()); + + // Replace with our test printer + aMsgMgr->ChangePrinters().Clear(); + aMsgMgr->AddPrinter(aPrinter); + + // Scope block to test output of message on destruction of a stream buffer + { + Message_Messenger::StreamBuffer aSender = ::Message::SendInfo(); + + // Check that messages output to sender and directly to messenger do not intermix + aSender << "Sender message 1: start ..."; + aMsgMgr->Send("Direct message 1"); + aSender << "... end" << std::endl; // endl should send the message + + // Check that empty stream buffer does not produce output on destruction + ::Message::SendInfo(); + + // Additional message to check that they go in expected order + aMsgMgr->Send("Direct message 2"); + + // Check that empty stream buffer does produce empty line if std::endl is passed + ::Message::SendInfo() << std::endl; + + // Last message should be sent on destruction of a sender + aSender << "Sender message 2"; + } + + // Restore original printers + aMsgMgr->ChangePrinters().Clear(); + aMsgMgr->ChangePrinters().Append(anOriginalPrinters); + + // Verify the output matches expected format + std::string anOutputStr = anOutput.str(); + + // Expected messages in order: + // 1. Direct message 1 + // 2. Sender message 1: start ...... end + // 3. Direct message 2 + // 4. Empty line + // 5. Sender message 2 + EXPECT_NE(anOutputStr.find("Direct message 1"), std::string::npos) + << "Direct message 1 should be present"; + EXPECT_NE(anOutputStr.find("Sender message 1: start ...... end"), std::string::npos) + << "Sender message 1 should be complete and present"; + EXPECT_NE(anOutputStr.find("Direct message 2"), std::string::npos) + << "Direct message 2 should be present"; + EXPECT_NE(anOutputStr.find("Sender message 2"), std::string::npos) + << "Sender message 2 should be present"; + + // Verify order: Direct 1 should come before Sender 1 + size_t aDirect1Pos = anOutputStr.find("Direct message 1"); + size_t aSender1Pos = anOutputStr.find("Sender message 1"); + size_t aDirect2Pos = anOutputStr.find("Direct message 2"); + size_t aSender2Pos = anOutputStr.find("Sender message 2"); + + EXPECT_LT(aDirect1Pos, aSender1Pos) << "Direct message 1 should appear before Sender message 1"; + EXPECT_LT(aSender1Pos, aDirect2Pos) << "Sender message 1 should appear before Direct message 2"; + EXPECT_LT(aDirect2Pos, aSender2Pos) << "Direct message 2 should appear before Sender message 2"; +} + +TEST(Message_Messenger_Test, StreamBufferBasicUsage) +{ + // Test basic stream buffer functionality + std::ostringstream anOutput; + Handle(TestMessagePrinter) aPrinter = new TestMessagePrinter(anOutput); + const Handle(Message_Messenger)& aMsgMgr = Message::DefaultMessenger(); + + Message_SequenceOfPrinters anOriginalPrinters; + anOriginalPrinters.Append(aMsgMgr->ChangePrinters()); + + aMsgMgr->ChangePrinters().Clear(); + aMsgMgr->AddPrinter(aPrinter); + { + Message_Messenger::StreamBuffer aBuffer = Message::SendInfo(); + aBuffer << "Test message" << std::endl; + } + + aMsgMgr->ChangePrinters().Clear(); + aMsgMgr->ChangePrinters().Append(anOriginalPrinters); + + std::string anOutputStr = anOutput.str(); + EXPECT_NE(anOutputStr.find("Test message"), std::string::npos) + << "Stream buffer should output message"; +} diff --git a/src/FoundationClasses/TKernel/GTests/NCollection_List_Test.cxx b/src/FoundationClasses/TKernel/GTests/NCollection_List_Test.cxx index f4f6573340..793590d4c0 100644 --- a/src/FoundationClasses/TKernel/GTests/NCollection_List_Test.cxx +++ b/src/FoundationClasses/TKernel/GTests/NCollection_List_Test.cxx @@ -12,6 +12,7 @@ // commercial license or contractual agreement. #include +#include #include #include @@ -449,4 +450,38 @@ TEST_F(NCollection_ListTest, STLAlgorithmCompatibility_Replace) std::replace(aStdList.begin(), aStdList.end(), aTargetValue, aNewValue); EXPECT_TRUE(std::equal(aList.begin(), aList.end(), aStdList.begin())); +} + +TEST_F(NCollection_ListTest, OCC25348_AssignDoesNotChangeAllocator) +{ + // Bug OCC25348: Method Assign of NCollection containers must not change + // own allocator of the target + // This test verifies that calling Assign() doesn't change the allocator + // of the target list + + Handle(NCollection_IncAllocator) anAlloc1 = new NCollection_IncAllocator(); + NCollection_List aList1(anAlloc1); + + // Perform multiple assign operations with different source lists, + // each having their own allocator + for (int i = 0; i < 10; i++) + { + Handle(NCollection_IncAllocator) anAlloc2 = new NCollection_IncAllocator(); + NCollection_List aList2(anAlloc2); + aList2.Append(i); + + // Store the allocator before Assign + Handle(NCollection_BaseAllocator) anAllocBefore = aList1.Allocator(); + + // Assign aList2 to aList1 + aList1.Assign(aList2); + + // Verify that the allocator of aList1 hasn't changed + Handle(NCollection_BaseAllocator) anAllocAfter = aList1.Allocator(); + EXPECT_EQ(anAllocBefore, anAllocAfter) << "Assign() should not change the target's allocator"; + + // Verify the content was copied correctly + EXPECT_EQ(1, aList1.Size()); + EXPECT_EQ(i, aList1.First()); + } } \ No newline at end of file diff --git a/src/FoundationClasses/TKernel/GTests/NCollection_Sequence_Test.cxx b/src/FoundationClasses/TKernel/GTests/NCollection_Sequence_Test.cxx index a09e06a15e..aa70ce7bef 100644 --- a/src/FoundationClasses/TKernel/GTests/NCollection_Sequence_Test.cxx +++ b/src/FoundationClasses/TKernel/GTests/NCollection_Sequence_Test.cxx @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -439,4 +440,24 @@ TEST(NCollection_SequenceTest, STLAlgorithmCompatibility_Reverse) std::reverse(aStdList.begin(), aStdList.end()); EXPECT_TRUE(std::equal(aSequence.begin(), aSequence.end(), aStdList.begin())); +} + +TEST(NCollection_SequenceTest, OCC26448_PrependEmptySequence) +{ + // Bug OCC26448: Method Prepend() of sequence breaks it if argument is empty sequence + // This test verifies that prepending an empty sequence doesn't affect the target sequence + + // Test with NCollection_Sequence + NCollection_Sequence aNSeq1, aNSeq2; + aNSeq1.Append(11.); + aNSeq1.Prepend(aNSeq2); // Prepend empty sequence + EXPECT_EQ(aNSeq1.Size(), 1); + EXPECT_DOUBLE_EQ(aNSeq1.First(), 11.0); + + // Test with TColStd_SequenceOfReal + TColStd_SequenceOfReal aTSeq1, aTSeq2; + aTSeq1.Append(11.); + aTSeq1.Prepend(aTSeq2); // Prepend empty sequence + EXPECT_EQ(aTSeq1.Size(), 1); + EXPECT_DOUBLE_EQ(aTSeq1.First(), 11.0); } \ No newline at end of file diff --git a/src/FoundationClasses/TKernel/GTests/Standard_Failure_Test.cxx b/src/FoundationClasses/TKernel/GTests/Standard_Failure_Test.cxx new file mode 100644 index 0000000000..2264bb803c --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/Standard_Failure_Test.cxx @@ -0,0 +1,45 @@ +// 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_Failure_Test, OCC670_ExceptionWithoutMessage) +{ + // Bug OCC670: Problem with the Print method + // This test verifies that an exception initialized without a message string + // can be safely handled and printed + + bool aCaught = false; + try + { + throw Standard_OutOfRange("test"); + } + catch (Standard_Failure const& anException) + { + aCaught = true; + + // Verify that the exception can be safely printed + std::ostringstream aStream; + EXPECT_NO_THROW(aStream << anException); + + // Verify that printing produced some output + std::string aMessage = aStream.str(); + EXPECT_FALSE(aMessage.empty()) << "Exception message should not be empty"; + } + + EXPECT_TRUE(aCaught) << "Exception should have been caught"; +} diff --git a/src/FoundationClasses/TKernel/GTests/Standard_GUID_Test.cxx b/src/FoundationClasses/TKernel/GTests/Standard_GUID_Test.cxx new file mode 100644 index 0000000000..9cc5b3e397 --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/Standard_GUID_Test.cxx @@ -0,0 +1,123 @@ +// 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_GUID_Test, OCC669_ValidGUIDConstruction) +{ + // Bug OCC669: Standard_GUID(HoleFeature) cause stack overwrite + // This test verifies that Standard_GUID correctly parses various valid GUID strings + // with hex digits (0-9, a-f, A-F) in different positions + + // Test GUIDs with uppercase hex digits A-F + EXPECT_NO_THROW(Standard_GUID("0000000A-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000B-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000C-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000D-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000E-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000F-0000-0000-0000-000000000000")); + + // Test GUIDs with lowercase hex digits a-f + EXPECT_NO_THROW(Standard_GUID("0000000a-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000b-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000c-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000d-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000e-0000-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("0000000f-0000-0000-0000-000000000000")); + + // Test hex digits in second group + EXPECT_NO_THROW(Standard_GUID("00000000-000A-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-000F-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-000a-0000-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-000f-0000-0000-000000000000")); + + // Test hex digits in third group + EXPECT_NO_THROW(Standard_GUID("00000000-0000-000A-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-000F-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-000a-0000-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-000f-0000-000000000000")); + + // Test hex digits in fourth group + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-000A-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-000F-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-000a-000000000000")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-000f-000000000000")); + + // Test hex digits in fifth group + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-0000-00000000000A")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-0000-00000000000F")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-0000-00000000000a")); + EXPECT_NO_THROW(Standard_GUID("00000000-0000-0000-0000-00000000000f")); +} + +TEST(Standard_GUID_Test, OCC669_InvalidGUIDConstruction) +{ + // Test that invalid GUID strings throw exceptions or fail gracefully + // Invalid characters (G/g instead of valid hex) + EXPECT_THROW(Standard_GUID("0000000G-0000-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("0000000g-0000-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-000G-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-000g-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-000G-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-000g-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-000G-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-000g-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-0000-00000000000G"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-0000-00000000000g"), Standard_Failure); + + // Invalid formats - wrong lengths + EXPECT_THROW(Standard_GUID("000000000000000000000000000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("0000000000000000000000000000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000000000000000000000000000000"), Standard_Failure); + + // Invalid formats - wrong group lengths + EXPECT_THROW(Standard_GUID("0000000000000-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-000000000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-000000000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-00000000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("000000000-0000-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("0000000-0000-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-00000-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-000-0000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-00000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-000-0000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-00000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-000-000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-0000-0000000000000"), Standard_Failure); + EXPECT_THROW(Standard_GUID("00000000-0000-0000-0000-00000000000"), Standard_Failure); + + // Empty string + EXPECT_THROW(Standard_GUID(""), Standard_Failure); +} + +TEST(Standard_GUID_Test, OCC669_GUIDFormatting) +{ + // Test that a valid GUID can be constructed and formatted back to a string + Standard_GUID aGUID1("00000000-0000-0000-0000-000000000000"); + Standard_GUID aGUID2("0000000A-000B-000C-000D-00000000000E"); + Standard_GUID aGUID3("0000000a-000b-000c-000d-00000000000e"); + + // Verify that GUIDs with the same string representation are equal + Standard_GUID aGUID4("0000000A-000B-000C-000D-00000000000E"); + EXPECT_EQ(aGUID2, aGUID4); + + // Verify that uppercase and lowercase hex digits create equal GUIDs + EXPECT_EQ(aGUID2, aGUID3); + + // Verify that different GUIDs are not equal + EXPECT_NE(aGUID1, aGUID2); +} diff --git a/src/FoundationClasses/TKernel/GTests/TopLoc_Location_Test.cxx b/src/FoundationClasses/TKernel/GTests/TopLoc_Location_Test.cxx new file mode 100644 index 0000000000..890e3fa85b --- /dev/null +++ b/src/FoundationClasses/TKernel/GTests/TopLoc_Location_Test.cxx @@ -0,0 +1,91 @@ +// 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 + +namespace +{ +//! Functor for testing concurrent access to TopLoc_Location::Transformation() +struct TopLocTransformFunctor +{ + TopLocTransformFunctor(const std::vector& theShapeVec) + : myShapeVec(&theShapeVec), + myIsRaceDetected(0) + { + } + + void operator()(size_t i) const + { + if (!myIsRaceDetected) + { + const TopoDS_Vertex& aVertex = TopoDS::Vertex(myShapeVec->at(i)); + gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); + if (aPoint.X() != static_cast(i)) + { + ++myIsRaceDetected; + } + } + } + + const std::vector* myShapeVec; + mutable std::atomic myIsRaceDetected; +}; +} // namespace + +TEST(TopLoc_Location_Test, OCC25545_ConcurrentTransformationAccess) +{ + // Bug OCC25545: TopLoc_Location::Transformation() provokes data races + // This test verifies that concurrent access to TopLoc_Location::Transformation() + // does not cause data races or incorrect geometry results + + // Place vertices in a vector, giving the i-th vertex the + // transformation that translates it on the vector (i,0,0) from the origin + Standard_Integer n = 1000; + std::vector aShapeVec(n); + std::vector aLocVec(n); + TopoDS_Shape aShape = BRepBuilderAPI_MakeVertex(gp::Origin()); + aShapeVec[0] = aShape; + + for (Standard_Integer i = 1; i < n; ++i) + { + gp_Trsf aTrsf; + aTrsf.SetTranslation(gp_Vec(1, 0, 0)); + aLocVec[i] = aLocVec[i - 1] * aTrsf; + aShapeVec[i] = aShape.Moved(aLocVec[i]); + } + + // Evaluator function will access vertices geometry concurrently + TopLocTransformFunctor aFunc(aShapeVec); + + // Process concurrently + OSD_Parallel::For(0, n, aFunc); + + // Verify no data race was detected + EXPECT_EQ(aFunc.myIsRaceDetected, 0) + << "Data race detected in concurrent TopLoc_Location::Transformation() access"; +} diff --git a/src/ModelingAlgorithms/TKExpress/GTests/Expr_GeneralExpression_Test.cxx b/src/ModelingAlgorithms/TKExpress/GTests/Expr_GeneralExpression_Test.cxx new file mode 100644 index 0000000000..65a81eec11 --- /dev/null +++ b/src/ModelingAlgorithms/TKExpress/GTests/Expr_GeneralExpression_Test.cxx @@ -0,0 +1,54 @@ +// 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 + +TEST(Expr_GeneralExpression_Test, OCC902_ExpressionDerivative) +{ + // Bug OCC902: Bad derivative computation + // This test verifies that the derivative of Exp(5*x) is correctly computed + // The expected result is either "Exp(5*x)*5" or "5*Exp(5*x)" + + TCollection_AsciiString anExpStr("5"); + anExpStr.AssignCat("*x"); + anExpStr.Prepend("Exp("); + anExpStr.AssignCat(")"); + + Handle(ExprIntrp_GenExp) anExprIntrp = ExprIntrp_GenExp::Create(); + + // Create the expression + anExprIntrp->Process(anExpStr); + + ASSERT_TRUE(anExprIntrp->IsDone()) << "Expression interpretation should succeed"; + + Handle(Expr_GeneralExpression) anExpr = anExprIntrp->Expression(); + ASSERT_FALSE(anExpr.IsNull()) << "Expression should not be null"; + + Handle(Expr_NamedUnknown) aVar = new Expr_NamedUnknown("x"); + Handle(Expr_GeneralExpression) aNewExpr = anExpr->Derivative(aVar); + + ASSERT_FALSE(aNewExpr.IsNull()) << "Derivative should not be null"; + + TCollection_AsciiString aDerivativeStr = aNewExpr->String(); + + // The derivative of Exp(5*x) should be either "Exp(5*x)*5" or "5*Exp(5*x)" + bool isCorrect = (aDerivativeStr == "Exp(5*x)*5") || (aDerivativeStr == "5*Exp(5*x)"); + + EXPECT_TRUE(isCorrect) << "Derivative result was: " << aDerivativeStr.ToCString() + << ", expected either 'Exp(5*x)*5' or '5*Exp(5*x)'"; +} diff --git a/src/ModelingAlgorithms/TKExpress/GTests/FILES.cmake b/src/ModelingAlgorithms/TKExpress/GTests/FILES.cmake index bb3305112c..e1c4b18e8f 100644 --- a/src/ModelingAlgorithms/TKExpress/GTests/FILES.cmake +++ b/src/ModelingAlgorithms/TKExpress/GTests/FILES.cmake @@ -2,4 +2,5 @@ set(OCCT_TKExpress_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKExpress_GTests_FILES + Expr_GeneralExpression_Test.cxx ) diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake b/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake index 28e3ce3e0f..f235ec54cb 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake +++ b/src/ModelingAlgorithms/TKGeomAlgo/GTests/FILES.cmake @@ -3,6 +3,7 @@ set(OCCT_TKGeomAlgo_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKGeomAlgo_GTests_FILES Geom2dAPI_InterCurveCurve_Test.cxx + Geom2dGcc_Circ2d3Tan_Test.cxx GeomFill_CorrectedFrenet_Test.cxx GeomPlate_BuildPlateSurface_Test.cxx ) \ No newline at end of file diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GTests/Geom2dGcc_Circ2d3Tan_Test.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GTests/Geom2dGcc_Circ2d3Tan_Test.cxx new file mode 100644 index 0000000000..06ca109d9a --- /dev/null +++ b/src/ModelingAlgorithms/TKGeomAlgo/GTests/Geom2dGcc_Circ2d3Tan_Test.cxx @@ -0,0 +1,77 @@ +// 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 + +TEST(Geom2dGcc_Circ2d3Tan_Test, OCC353_TangentCircleDoesNotHang) +{ + // Bug OCC353: Attached DRAW command hangs in Geom2dGcc_Circ2d3Tan + // This test verifies that computing a circle tangent to two circles and + // passing through a point doesn't hang + + // Create two 3D circles + gp_Ax2 anAx21(gp_Pnt(100, 0, 0), gp_Dir(gp::DZ())); + Handle(Geom_Circle) aCirc1 = new Geom_Circle(anAx21, 25); + + gp_Ax2 anAx22(gp_Pnt(-100, 0, 0), gp_Dir(gp::DZ())); + Handle(Geom_Circle) aCirc2 = new Geom_Circle(anAx22, 25); + + // Reference plane for 2D projection + gp_Pln aRefPln(gp_Pnt(0, 0, 0), gp_Dir(gp::DZ())); + + // Convert 3D circles to 2D + Handle(Geom2d_Curve) aCirc2d1 = GeomAPI::To2d(aCirc1, aRefPln); + Handle(Geom2d_Curve) aCirc2d2 = GeomAPI::To2d(aCirc2, aRefPln); + + // Create adaptors + Geom2dAdaptor_Curve anAdap1(aCirc2d1); + Geom2dAdaptor_Curve anAdap2(aCirc2d2); + + // Create qualified curves (enclosing) + Geom2dGcc_QualifiedCurve aQCur1(anAdap1, GccEnt_enclosing); + Geom2dGcc_QualifiedCurve aQCur2(anAdap2, GccEnt_enclosing); + + // Create a 2D point + gp_Pnt2d aPt2d(0, 175); + Handle(Geom2d_CartesianPoint) aPt = new Geom2d_CartesianPoint(aPt2d); + + // Compute tangent circle - this should not hang + Geom2dGcc_Circ2d3Tan aSol(aQCur1, aQCur2, aPt, 0.001, 0.0, 0.0); + + // Verify that the computation completed successfully + EXPECT_TRUE(aSol.IsDone()) << "Geom2dGcc_Circ2d3Tan computation should complete"; + + // Verify that we have solutions + if (aSol.IsDone()) + { + Standard_Integer aNbSol = aSol.NbSolutions(); + EXPECT_GT(aNbSol, 0) << "Should find at least one solution"; + + // Verify that we can access the solutions + for (Standard_Integer i = 1; i <= aNbSol; i++) + { + EXPECT_NO_THROW(aSol.ThisSolution(i)) << "Should be able to access solution " << i; + } + } +} diff --git a/src/ModelingAlgorithms/TKMesh/GTests/BRepMesh_GeomTool_Test.cxx b/src/ModelingAlgorithms/TKMesh/GTests/BRepMesh_GeomTool_Test.cxx new file mode 100644 index 0000000000..ad1e58edde --- /dev/null +++ b/src/ModelingAlgorithms/TKMesh/GTests/BRepMesh_GeomTool_Test.cxx @@ -0,0 +1,86 @@ +// 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 + +TEST(BRepMesh_GeomTool_Test, OCC25547_StaticMethodsExportAndFunctionality) +{ + // Bug OCC25547: static class methods not exported in BRepMesh_GeomTool + // This test verifies that BRepMesh_GeomTool static methods are properly exported + // and functional + + // Test 1: Discretize an arc + const Standard_Real aFirstP = 0., aLastP = M_PI; + Handle(Geom_Circle) aCircle = new Geom_Circle(gp_Ax2(gp::Origin(), gp::DZ()), 10); + Handle(Geom_TrimmedCurve) aHalf = new Geom_TrimmedCurve(aCircle, aFirstP, aLastP); + TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(aHalf); + BRepAdaptor_Curve anAdaptor(anEdge); + BRepMesh_GeomTool aGeomTool(anAdaptor, aFirstP, aLastP, 0.1, 0.5); + + EXPECT_GT(aGeomTool.NbPoints(), 0) << "BRepMesh_GeomTool failed to discretize an arc"; + + // Test 2: Test Normal() static method + TopoDS_Face aFace = BRepBuilderAPI_MakeFace(gp_Pln(gp::Origin(), gp::DZ())); + BRepAdaptor_Surface aSurf(aFace); + Handle(BRepAdaptor_Surface) aHSurf = new BRepAdaptor_Surface(aSurf); + + gp_Pnt aPnt; + gp_Dir aNormal; + Standard_Boolean isNormalComputed = BRepMesh_GeomTool::Normal(aHSurf, 10., 10., aPnt, aNormal); + + EXPECT_TRUE(isNormalComputed) << "BRepMesh_GeomTool failed to compute a normal of surface"; + + // Test 3: Test IntLinLin() static method - line-line intersection + gp_XY aRefPnts[4] = {gp_XY(-10., -10.), gp_XY(10., 10.), gp_XY(-10., 10.), gp_XY(10., -10.)}; + + gp_Pnt2d anIntPnt; + Standard_Real aParams[2]; + BRepMesh_GeomTool::IntFlag anIntFlag = BRepMesh_GeomTool::IntLinLin(aRefPnts[0], + aRefPnts[1], + aRefPnts[2], + aRefPnts[3], + anIntPnt.ChangeCoord(), + aParams); + + Standard_Real aDiff = anIntPnt.Distance(gp::Origin2d()); + EXPECT_EQ(anIntFlag, BRepMesh_GeomTool::Cross) + << "BRepMesh_GeomTool::IntLinLin should return Cross flag"; + EXPECT_LE(aDiff, Precision::PConfusion()) + << "BRepMesh_GeomTool failed to intersect two lines at origin"; + + // Test 4: Test IntSegSeg() static method - segment-segment intersection + anIntFlag = BRepMesh_GeomTool::IntSegSeg(aRefPnts[0], + aRefPnts[1], + aRefPnts[2], + aRefPnts[3], + Standard_False, + Standard_False, + anIntPnt); + + aDiff = anIntPnt.Distance(gp::Origin2d()); + EXPECT_EQ(anIntFlag, BRepMesh_GeomTool::Cross) + << "BRepMesh_GeomTool::IntSegSeg should return Cross flag"; + EXPECT_LE(aDiff, Precision::PConfusion()) + << "BRepMesh_GeomTool failed to intersect two segments at origin"; +} diff --git a/src/ModelingAlgorithms/TKMesh/GTests/FILES.cmake b/src/ModelingAlgorithms/TKMesh/GTests/FILES.cmake index 5cae3edf4c..df0a8f7a27 100644 --- a/src/ModelingAlgorithms/TKMesh/GTests/FILES.cmake +++ b/src/ModelingAlgorithms/TKMesh/GTests/FILES.cmake @@ -2,4 +2,5 @@ set(OCCT_TKMesh_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKMesh_GTests_FILES + BRepMesh_GeomTool_Test.cxx ) diff --git a/src/ModelingAlgorithms/TKPrim/GTests/BRepPrimAPI_MakePrism_Test.cxx b/src/ModelingAlgorithms/TKPrim/GTests/BRepPrimAPI_MakePrism_Test.cxx new file mode 100644 index 0000000000..c9e6026dd2 --- /dev/null +++ b/src/ModelingAlgorithms/TKPrim/GTests/BRepPrimAPI_MakePrism_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 + +#include + +TEST(BRepPrimAPI_MakePrism_Test, OCC31294_GeneratedListForNonBaseShape) +{ + // Bug OCC31294: Modeling Algorithms - Regression relatively 7.3.0. + // Crash in method BRepPrimAPI_MakePrism::Generated(...) if input sub-shape + // does not belong to the base shape + // + // This test verifies that calling Generated() with a shape that doesn't belong + // to the base shape doesn't crash and returns an empty list + + BRepBuilderAPI_MakeVertex aMkVert(gp_Pnt(0., 0., 0.)); + BRepBuilderAPI_MakeVertex aMkDummy(gp_Pnt(0., 0., 0.)); + BRepPrimAPI_MakePrism aMkPrism(aMkVert.Shape(), gp_Vec(0., 0., 1.)); + + // Check that Generated() returns 1 shape for the vertex used to create the prism + Standard_Integer aNbGen = aMkPrism.Generated(aMkVert.Shape()).Extent(); + EXPECT_EQ(aNbGen, 1); + + // Check that Generated() returns 0 shapes for a vertex not used to create the prism + // (this should not crash) + Standard_Integer aNbDummy = aMkPrism.Generated(aMkDummy.Shape()).Extent(); + EXPECT_EQ(aNbDummy, 0); +} diff --git a/src/ModelingAlgorithms/TKPrim/GTests/FILES.cmake b/src/ModelingAlgorithms/TKPrim/GTests/FILES.cmake index ef84f81c93..2dbfdbb1ea 100644 --- a/src/ModelingAlgorithms/TKPrim/GTests/FILES.cmake +++ b/src/ModelingAlgorithms/TKPrim/GTests/FILES.cmake @@ -2,4 +2,5 @@ set(OCCT_TKPrim_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKPrim_GTests_FILES + BRepPrimAPI_MakePrism_Test.cxx ) diff --git a/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepBuilderAPI_MakeWire_Test.cxx b/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepBuilderAPI_MakeWire_Test.cxx new file mode 100644 index 0000000000..de34d6c3a8 --- /dev/null +++ b/src/ModelingAlgorithms/TKTopAlgo/GTests/BRepBuilderAPI_MakeWire_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 + +#include + +TEST(BRepBuilderAPI_MakeWire_Test, OCC27552_AddEdgesAndListOfEdges) +{ + // Bug OCC27552: Wire creation fails depending on the order of edges + // This test verifies that BRepBuilderAPI_MakeWire can successfully add + // edges individually and as a list + + BRep_Builder aBB; + TopoDS_Vertex aV1, aV2, aV3; + TopoDS_Edge anE1, anE2; + + // Create vertices + aBB.MakeVertex(aV1, gp_Pnt(0, 0, 0), 0.1); + aBB.MakeVertex(aV2, gp_Pnt(5, 0, 0), 0.1); + aBB.MakeVertex(aV3, gp_Pnt(10, 0, 0), 0.1); + + // Create edges + anE1 = BRepBuilderAPI_MakeEdge(aV1, aV2).Edge(); + anE2 = BRepBuilderAPI_MakeEdge(aV2, aV3).Edge(); + + // Build wire with individually added edges + BRepBuilderAPI_MakeWire aMW; + EXPECT_NO_THROW(aMW.Add(anE1)); + EXPECT_NO_THROW(aMW.Add(anE2)); + + // Create additional vertices and edges for list test + TopoDS_Vertex aV4, aV5, aV6, aV7; + TopoDS_Edge anE3, anE4; + aBB.MakeVertex(aV4, gp_Pnt(10, 0.05, 0), 0.07); + aBB.MakeVertex(aV5, gp_Pnt(10, -0.05, 0), 0.07); + aBB.MakeVertex(aV6, gp_Pnt(10, 2, 0), 0.07); + aBB.MakeVertex(aV7, gp_Pnt(10, -2, 0), 0.07); + + anE3 = BRepBuilderAPI_MakeEdge(aV4, aV6).Edge(); + anE4 = BRepBuilderAPI_MakeEdge(aV5, aV7).Edge(); + + // Add edges as a list + TopTools_ListOfShape aListOfEdges; + aListOfEdges.Append(anE3); + aListOfEdges.Append(anE4); + + EXPECT_NO_THROW(aMW.Add(aListOfEdges)); + + // Verify wire was created successfully + EXPECT_TRUE(aMW.IsDone()) << "Wire builder should complete successfully"; + TopoDS_Wire aWire = aMW.Wire(); + EXPECT_FALSE(aWire.IsNull()) << "Resulting wire should not be null"; +} diff --git a/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake b/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake index 6e40956020..17aaf59d01 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake +++ b/src/ModelingAlgorithms/TKTopAlgo/GTests/FILES.cmake @@ -2,6 +2,7 @@ set(OCCT_TKTopAlgo_GTests_FILES_LOCATION "${CMAKE_CURRENT_LIST_DIR}") set(OCCT_TKTopAlgo_GTests_FILES + BRepBuilderAPI_MakeWire_Test.cxx BRepLib_MakeWire_Test.cxx BRepOffsetAPI_ThruSections_Test.cxx ) diff --git a/src/ModelingData/TKG2d/GTests/FILES.cmake b/src/ModelingData/TKG2d/GTests/FILES.cmake index 8faa3bf08f..db61773428 100644 --- a/src/ModelingData/TKG2d/GTests/FILES.cmake +++ b/src/ModelingData/TKG2d/GTests/FILES.cmake @@ -5,5 +5,7 @@ set(OCCT_TKG2d_GTests_FILES Geom2d_BSplineCurve_Test.cxx Geom2d_BezierCurve_Test.cxx Geom2d_OffsetCurve_Test.cxx + Geom2dAPI_InterCurveCurve_Test.cxx + Geom2dGcc_Circ2d2TanOn_Test.cxx Geom2dGcc_Circ2d2TanRad_Test.cxx ) diff --git a/src/ModelingData/TKG2d/GTests/Geom2dAPI_InterCurveCurve_Test.cxx b/src/ModelingData/TKG2d/GTests/Geom2dAPI_InterCurveCurve_Test.cxx new file mode 100644 index 0000000000..b07511c2e8 --- /dev/null +++ b/src/ModelingData/TKG2d/GTests/Geom2dAPI_InterCurveCurve_Test.cxx @@ -0,0 +1,75 @@ +// 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, OCC24889_IntersectionParameterWithinLimits) +{ + // Bug OCC24889: Geom2dAPI_InterCurveCurve produces result with parameter outside the curve limits + // This test verifies that intersection parameters are within the curve parameter limits + + // Create two circles + Handle(Geom2d_Circle) aCircle1 = + new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(25, -25), gp_Dir2d(gp_Dir2d::D::X), gp_Dir2d(-0, 1)), 155); + + Handle(Geom2d_Circle) aCircle2 = + new Geom2d_Circle(gp_Ax22d(gp_Pnt2d(25, 25), gp_Dir2d(gp_Dir2d::D::X), gp_Dir2d(-0, 1)), 155); + + // Create trimmed curves + Handle(Geom2d_TrimmedCurve) aTrim1 = + new Geom2d_TrimmedCurve(aCircle1, 1.57079632679490, 2.97959469729228); + Handle(Geom2d_TrimmedCurve) aTrim2 = + new Geom2d_TrimmedCurve(aCircle2, 3.30359060633978, 4.71238898038469); + + // Perform intersection + constexpr Standard_Real aTol = Precision::Confusion(); + Geom2dAPI_InterCurveCurve aIntTool(aTrim1, aTrim2, aTol); + + ASSERT_GT(aIntTool.NbPoints(), 0) << "Intersection should find at least one point"; + + const IntRes2d_IntersectionPoint& aIntPnt = aIntTool.Intersector().Point(1); + + Standard_Real aParOnC1 = aIntPnt.ParamOnFirst(); + Standard_Real aParOnC2 = aIntPnt.ParamOnSecond(); + Standard_Real aFirstPar1 = aTrim1->FirstParameter(); + Standard_Real aLastPar1 = aTrim1->LastParameter(); + Standard_Real aFirstPar2 = aTrim2->FirstParameter(); + Standard_Real aLastPar2 = aTrim2->LastParameter(); + + // Verify that intersection parameters are within the curve limits + EXPECT_GE(aParOnC1, aFirstPar1) << "IntParameter on curve 1 (" << aParOnC1 + << ") should be >= FirstParam (" << aFirstPar1 << ")"; + EXPECT_LE(aParOnC1, aLastPar1) << "IntParameter on curve 1 (" << aParOnC1 + << ") should be <= LastParam (" << aLastPar1 << ")"; + + EXPECT_GE(aParOnC2, aFirstPar2) << "IntParameter on curve 2 (" << aParOnC2 + << ") should be >= FirstParam (" << aFirstPar2 << ")"; + EXPECT_LE(aParOnC2, aLastPar2) << "IntParameter on curve 2 (" << aParOnC2 + << ") should be <= LastParam (" << aLastPar2 << ")"; + + // Verify that both curves evaluate to the same point at the intersection parameters + gp_Pnt2d aP1 = aTrim1->Value(aParOnC1); + gp_Pnt2d aP2 = aTrim2->Value(aParOnC2); + + Standard_Real aDist2 = aP1.SquareDistance(aP2); + EXPECT_LT(aDist2, 1.0e-14) << "Points on both curves at intersection parameters should coincide"; +} diff --git a/src/ModelingData/TKG2d/GTests/Geom2dGcc_Circ2d2TanOn_Test.cxx b/src/ModelingData/TKG2d/GTests/Geom2dGcc_Circ2d2TanOn_Test.cxx new file mode 100644 index 0000000000..b16411854d --- /dev/null +++ b/src/ModelingData/TKG2d/GTests/Geom2dGcc_Circ2d2TanOn_Test.cxx @@ -0,0 +1,75 @@ +// 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 + +TEST(Geom2dGcc_Circ2d2TanOn_Test, OCC27357_NoExceptions) +{ + // Bug OCC27357: Geom2dGcc_Circ2d2TanOn: check status of sub-algorithms to avoid exceptions + // This test verifies that the algorithm handles edge cases without throwing exceptions + + TColgp_Array1OfPnt2d aPoles(1, 3); + aPoles.SetValue(1, gp_Pnt2d(0., 0.)); + aPoles.SetValue(2, gp_Pnt2d(0., 1.)); + aPoles.SetValue(3, gp_Pnt2d(6., 0.)); + + Handle(Geom2d_BezierCurve) aCurve1 = new Geom2d_BezierCurve(aPoles); + aPoles.SetValue(2, gp_Pnt2d(0., 1.5)); + Handle(Geom2d_BezierCurve) aCurve2 = new Geom2d_BezierCurve(aPoles); + NCollection_List aDummyList; + int nP = 100; + + for (int i = 0; i < nP; i++) + { + Standard_Real u = i / (nP - 1.); + gp_Pnt2d aP1; + gp_Vec2d aTangent; + aCurve1->D1(u, aP1, aTangent); + gp_Vec2d aNormal(-aTangent.Y(), aTangent.X()); + Handle(Geom2d_Line) aNormalLine = new Geom2d_Line(aP1, gp_Dir2d(aNormal)); + Geom2dGcc_QualifiedCurve aQualifiedC1(Geom2dAdaptor_Curve(aCurve1), GccEnt_unqualified); + Geom2dGcc_QualifiedCurve aQualifiedC2(Geom2dAdaptor_Curve(aCurve2), GccEnt_unqualified); + + // This should not throw an exception even in edge cases + EXPECT_NO_THROW({ + Geom2dAPI_ProjectPointOnCurve aProjPc1(aP1, aCurve1); + double g1 = aProjPc1.LowerDistanceParameter(); + Geom2dAPI_ProjectPointOnCurve aProjPc3(aP1, aNormalLine); + double g3 = aProjPc3.LowerDistanceParameter(); + Geom2dGcc_Circ2d2TanOn aCircleBuilder(aQualifiedC1, + aQualifiedC2, + Geom2dAdaptor_Curve(aNormalLine), + 1e-9, + g1, + g1, + g3); + aDummyList.Append(aCircleBuilder.NbSolutions()); + }); + } + + // Test completed without exceptions + SUCCEED(); +} diff --git a/tests/bugs/caf/bug24755 b/tests/bugs/caf/bug24755 deleted file mode 100755 index dace57f3f9..0000000000 --- a/tests/bugs/caf/bug24755 +++ /dev/null @@ -1,7 +0,0 @@ -puts "===========" -puts "OCC24755" -puts "===========" - -pload QAcommands - -OCC24755 diff --git a/tests/bugs/caf/bug669 b/tests/bugs/caf/bug669 deleted file mode 100755 index 253f40a1bb..0000000000 --- a/tests/bugs/caf/bug669 +++ /dev/null @@ -1,158 +0,0 @@ -puts "All exceptions is OK" -puts "TODO OCC12345 ALL: An exception was caught" - -puts "========" -puts "0000669: Standard_GUID(HoleFeature) cause stack overwrite" -puts "========" -puts "" - -pload QAcommands - -set GoodGUIDList [list 00000000-0000-0000-0000-000000000000 \ - \ - 0000000A-0000-0000-0000-000000000000 \ - 0000000B-0000-0000-0000-000000000000 \ - 0000000C-0000-0000-0000-000000000000 \ - 0000000D-0000-0000-0000-000000000000 \ - 0000000E-0000-0000-0000-000000000000 \ - 0000000F-0000-0000-0000-000000000000 \ - \ - 0000000a-0000-0000-0000-000000000000 \ - 0000000b-0000-0000-0000-000000000000 \ - 0000000c-0000-0000-0000-000000000000 \ - 0000000d-0000-0000-0000-000000000000 \ - 0000000e-0000-0000-0000-000000000000 \ - 0000000f-0000-0000-0000-000000000000 \ - \ - 00000000-000A-0000-0000-000000000000 \ - 00000000-000B-0000-0000-000000000000 \ - 00000000-000C-0000-0000-000000000000 \ - 00000000-000D-0000-0000-000000000000 \ - 00000000-000E-0000-0000-000000000000 \ - 00000000-000F-0000-0000-000000000000 \ - \ - 00000000-000a-0000-0000-000000000000 \ - 00000000-000b-0000-0000-000000000000 \ - 00000000-000c-0000-0000-000000000000 \ - 00000000-000d-0000-0000-000000000000 \ - 00000000-000e-0000-0000-000000000000 \ - 00000000-000f-0000-0000-000000000000 \ - \ - 00000000-0000-000A-0000-000000000000 \ - 00000000-0000-000B-0000-000000000000 \ - 00000000-0000-000C-0000-000000000000 \ - 00000000-0000-000D-0000-000000000000 \ - 00000000-0000-000E-0000-000000000000 \ - 00000000-0000-000F-0000-000000000000 \ - \ - 00000000-0000-000a-0000-000000000000 \ - 00000000-0000-000b-0000-000000000000 \ - 00000000-0000-000c-0000-000000000000 \ - 00000000-0000-000d-0000-000000000000 \ - 00000000-0000-000e-0000-000000000000 \ - 00000000-0000-000f-0000-000000000000 \ - \ - 00000000-0000-0000-000A-000000000000 \ - 00000000-0000-0000-000B-000000000000 \ - 00000000-0000-0000-000C-000000000000 \ - 00000000-0000-0000-000D-000000000000 \ - 00000000-0000-0000-000E-000000000000 \ - 00000000-0000-0000-000F-000000000000 \ - \ - 00000000-0000-0000-000a-000000000000 \ - 00000000-0000-0000-000b-000000000000 \ - 00000000-0000-0000-000c-000000000000 \ - 00000000-0000-0000-000d-000000000000 \ - 00000000-0000-0000-000e-000000000000 \ - 00000000-0000-0000-000f-000000000000 \ - \ - 00000000-0000-0000-0000-00000000000A \ - 00000000-0000-0000-0000-00000000000B \ - 00000000-0000-0000-0000-00000000000C \ - 00000000-0000-0000-0000-00000000000D \ - 00000000-0000-0000-0000-00000000000E \ - 00000000-0000-0000-0000-00000000000F \ - \ - 00000000-0000-0000-0000-00000000000a \ - 00000000-0000-0000-0000-00000000000b \ - 00000000-0000-0000-0000-00000000000c \ - 00000000-0000-0000-0000-00000000000d \ - 00000000-0000-0000-0000-00000000000e \ - 00000000-0000-0000-0000-00000000000f ] - -set BadGUIDList [list \ - \ - 0000000G-0000-0000-0000-000000000000 \ - 0000000g-0000-0000-0000-000000000000 \ - \ - 00000000-000G-0000-0000-000000000000 \ - 00000000-000g-0000-0000-000000000000 \ - \ - 00000000-0000-000G-0000-000000000000 \ - 00000000-0000-000g-0000-000000000000 \ - \ - 00000000-0000-0000-000G-000000000000 \ - 00000000-0000-0000-000g-000000000000 \ - \ - 00000000-0000-0000-0000-00000000000G \ - 00000000-0000-0000-0000-00000000000g \ - \ - 000000000000000000000000000000000000 \ - 0000000000000000000000000000000000000 \ - 00000000000000000000000000000000000 \ - \ - 0000000000000-0000-0000-000000000000 \ - 00000000-000000000-0000-000000000000 \ - 00000000-0000-000000000-000000000000 \ - 00000000-0000-0000-00000000000000000 \ - \ - 000000000-0000-0000-0000-000000000000 \ - 0000000-0000-0000-0000-000000000000 \ - \ - 00000000-00000-0000-0000-000000000000 \ - 00000000-000-0000-0000-000000000000 \ - \ - 00000000-0000-00000-0000-000000000000 \ - 00000000-0000-000-0000-000000000000 \ - \ - 00000000-0000-0000-00000-000000000000 \ - 00000000-0000-0000-000-000000000000 \ - \ - 00000000-0000-0000-0000-0000000000000 \ - 00000000-0000-0000-0000-00000000000 \ - \ - "" ] - -set IsOK 1 - -set i 0 - -foreach GUID ${GoodGUIDList} { - incr i - if [catch { OCC669 ${GUID} }] then { - set IsOK 0 - puts "GUID=\"${GUID}\"" - puts "Faulty OCC669 (case ${i})" - } else { - puts "OCC669 OK (case ${i})" - } -} - - -foreach GUID ${BadGUIDList} { - incr i - if [catch { OCC669 ${GUID} }] then { - puts "OCC669 OK (case ${i})" - } else { - set IsOK 0 - puts "GUID=\"${GUID}\"" - puts "Faulty OCC669 (case ${i})" - } -} - -if { ${IsOK} == 1} { - puts "OCC669 OK" -} else { - puts "Faulty OCC669" -} - diff --git a/tests/bugs/caf/bug738_1 b/tests/bugs/caf/bug738_1 deleted file mode 100755 index 2a93f5087c..0000000000 --- a/tests/bugs/caf/bug738_1 +++ /dev/null @@ -1,17 +0,0 @@ -puts "========" -puts "OCC738" -puts "========" -puts "" -################################### -## The GUIDs in XCAFDoc have incorrect format. -################################### - -pload QAcommands - -if [catch { OCC738_Assembly }] then { - puts "Faulty OCC738" -} else { - puts "OCC738 OK" -} - - diff --git a/tests/bugs/caf/bug738_2 b/tests/bugs/caf/bug738_2 deleted file mode 100755 index b24ae07060..0000000000 --- a/tests/bugs/caf/bug738_2 +++ /dev/null @@ -1,17 +0,0 @@ -puts "========" -puts "OCC738" -puts "========" -puts "" -################################## -##The GUIDs in XCAFDoc have incorrect format. -################################## - -pload QAcommands - -if [catch { OCC738_ShapeRef }] then { - puts "Faulty OCC738" -} else { - puts "OCC738 OK" -} - - diff --git a/tests/bugs/fclasses/bug24836 b/tests/bugs/fclasses/bug24836 deleted file mode 100644 index d8cac9cd41..0000000000 --- a/tests/bugs/fclasses/bug24836 +++ /dev/null @@ -1,11 +0,0 @@ -puts "============" -puts "OCC24836" -puts "============" -puts "" -####################################################################### -# Stack overflow when raising exception in low memory condition -####################################################################### - -pload QAcommands - -OCC24836 diff --git a/tests/bugs/fclasses/bug25348 b/tests/bugs/fclasses/bug25348 deleted file mode 100644 index 6fe3a0eb3e..0000000000 --- a/tests/bugs/fclasses/bug25348 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC25348" -puts "========" -puts "" -####################################################################################### -# Method Assign of NCollection containers must not change own allocator of the target -####################################################################################### - -pload QAcommands - -OCC25348 diff --git a/tests/bugs/fclasses/bug25545 b/tests/bugs/fclasses/bug25545 deleted file mode 100644 index e743b23633..0000000000 --- a/tests/bugs/fclasses/bug25545 +++ /dev/null @@ -1,11 +0,0 @@ -puts "============" -puts "OCC25545" -puts "============" -puts "" -####################################################################### -# TopLoc_Location::Transformation() provokes data races -####################################################################### - -pload QAcommands - -OCC25545 diff --git a/tests/bugs/fclasses/bug26448 b/tests/bugs/fclasses/bug26448 deleted file mode 100644 index fe1f6635eb..0000000000 --- a/tests/bugs/fclasses/bug26448 +++ /dev/null @@ -1,10 +0,0 @@ -puts "============" -puts "OCC26448" -puts "============" -puts "" -####################################################################### -# Method Prepend() of sequence breaks it if argument is empty sequence -####################################################################### - -pload QAcommands -OCC26448 diff --git a/tests/bugs/fclasses/bug30492 b/tests/bugs/fclasses/bug30492 deleted file mode 100644 index 9ae534627c..0000000000 --- a/tests/bugs/fclasses/bug30492 +++ /dev/null @@ -1,8 +0,0 @@ -puts "============" -puts "0030492: Foundation Classes - math_BFGS fails if starting point is exactly the minimum" -puts "============" -puts "" - -pload QAcommands - -OCC30492 diff --git a/tests/bugs/fclasses/bug31189 b/tests/bugs/fclasses/bug31189 deleted file mode 100644 index ef57ec19c8..0000000000 --- a/tests/bugs/fclasses/bug31189 +++ /dev/null @@ -1,22 +0,0 @@ -puts "# ============" -puts "# 0031189: Draw Harness, ViewerTest - send messages to Message::DefaultMessenger()" -puts "# ============" -puts "" -puts "# Test consistency of messages output using stream buffer interface" - -pload QAcommands -set out [OCC31189] - -set expected { - {Direct message 1} - {Sender message 1: start ...... end} - {Direct message 2} - {} - {Sender message 2} -} - -if { [string compare [string trim $out] [join $expected "\n"]] } { - puts "Error: output (see above) does not match expected one:" - puts "[join $expected "\n"]" - puts "" -} \ No newline at end of file diff --git a/tests/bugs/fclasses/bug670 b/tests/bugs/fclasses/bug670 deleted file mode 100755 index 41022bc265..0000000000 --- a/tests/bugs/fclasses/bug670 +++ /dev/null @@ -1,11 +0,0 @@ -puts "========" -puts "OCC670: Problem with the Print method." -puts "========" -puts "" - -pload QAcommands - -# Check that exception is handled and does not kill DRAWEXE (TEST COMPLETED) -OCC670 - -puts "OCC670 OK" diff --git a/tests/bugs/fclasses/bug902 b/tests/bugs/fclasses/bug902 deleted file mode 100755 index 9e068d07af..0000000000 --- a/tests/bugs/fclasses/bug902 +++ /dev/null @@ -1,31 +0,0 @@ -puts "=======" -puts "OCC902" -puts "=======" -puts "" -############### -## bad derivative -############### - -pload QAcommands - -set arg 5 -set list [OCC902 $arg] - -set we_have [lindex $list 8] -puts "we_have = $we_have" - -set must_be_1 "Exp($arg*x)*$arg" -puts "must_be_1 = $must_be_1" -set must_be_2 "$arg*Exp($arg*x)" -puts "must_be_2 = $must_be_2" - -if {[string compare $we_have $must_be_1] == 0} { - puts "OCC902 OK" -} else { - if { [string compare $we_have $must_be_2] == 0} { - puts "OCC902 OK" - } else { - puts "OCC902 Faulty" - } -} - diff --git a/tests/bugs/mesh/bug25547 b/tests/bugs/mesh/bug25547 deleted file mode 100755 index 2c31bf7dd9..0000000000 --- a/tests/bugs/mesh/bug25547 +++ /dev/null @@ -1,11 +0,0 @@ -puts "=========" -puts "CR25547" -puts "=========" -puts "" -############################################### -# static class methods not exported in BrepMesh_GeomTool -############################################### - -pload QAcommands - -OCC25547 diff --git a/tests/bugs/modalg_5/bug24889 b/tests/bugs/modalg_5/bug24889 deleted file mode 100644 index 86850df14c..0000000000 --- a/tests/bugs/modalg_5/bug24889 +++ /dev/null @@ -1,38 +0,0 @@ -puts "==========" -puts "OCC24889" -puts "==========" -puts "" -##################################################################################### -# Geom2dAPI_InterCurveCurve produces result with parameter outside the curve limits -##################################################################################### - -pload QAcommands - -set info [OCC24889] -regexp {Curve 0: +FirstParam += +([-0-9.+eE]+); +LastParam += +([-0-9.+eE]+); +IntParameter += +([-0-9.+eE]+)} $info full first1 last1 intp1 -regexp {Curve 1: +FirstParam += +([-0-9.+eE]+); +LastParam += +([-0-9.+eE]+); +IntParameter += +([-0-9.+eE]+)} $info full first2 last2 intp2 - -if { $intp1 >= $first1 && $intp1 <= $last1 } { - puts "OK: IntParameter1 inside the curve limits" -} else { - puts "Error: IntParameter1 outside the curve limits" -} - -if { $intp2 >= $first2 && $intp2 <= $last2 } { - puts "OK: IntParameter2 inside the curve limits" -} else { - puts "Error: IntParameter2 outside the curve limits" -} - -2dcvalue c_1 $intp1 xx1 yy1 -2dcvalue c_2 $intp2 xx2 yy2 - -dump xx1 yy1 -dump xx2 yy2 - -set dist_val [dval (xx1-xx2)*(xx1-xx2)+(yy1-yy2)*(yy1-yy2)] -if { $dist_val < 1.0e-14 } { - puts "OK: point distance is good" -} else { - puts "Error: point distance is wrong" -} diff --git a/tests/bugs/modalg_6/bug27357 b/tests/bugs/modalg_6/bug27357 deleted file mode 100644 index 583b0894f5..0000000000 --- a/tests/bugs/modalg_6/bug27357 +++ /dev/null @@ -1,16 +0,0 @@ -puts "========" -puts "OCC27357" -puts "========" -puts "" -################################################################# -# Geom2dGcc_Circ2d2TanOn: check status of sub-algorithms to avoid exceptions -################################################################# - -pload QAcommands - -set info [OCC27357] -if { [regexp "Exception" $info] != 0 } { - puts "Error : Exception was caught" -} else { - puts "OK" -} diff --git a/tests/bugs/modalg_6/bug27552_3 b/tests/bugs/modalg_6/bug27552_3 deleted file mode 100644 index 3e02ffcfab..0000000000 --- a/tests/bugs/modalg_6/bug27552_3 +++ /dev/null @@ -1,16 +0,0 @@ -puts "==========" -puts "OCC27552" -puts "==========" -puts "" -####################################### -# Wire creation fails depending on the order of edges -####################################### - -pload QAcommands -OCC27552 - -#outw is output wire -checkshape outw -checknbshapes outw -vertex 5 -edge 4 -nexplode outw v -checkmaxtol outw_4 -ref 0.12 \ No newline at end of file diff --git a/tests/bugs/modalg_7/bug31294 b/tests/bugs/modalg_7/bug31294 deleted file mode 100644 index 028fc5cebc..0000000000 --- a/tests/bugs/modalg_7/bug31294 +++ /dev/null @@ -1,8 +0,0 @@ -puts "=======================================================" -puts "0031294: Modeling Algorithms - Regression relatively 7.3.0." -puts "Crash in method BRepPrimAPI_MakePrism::Generated(...) if input sub-shape does not belong to the base shape" -puts "=======================================================" -puts "" - -pload QAcommands -OCC31294 \ No newline at end of file diff --git a/tests/bugs/moddata_2/bug353 b/tests/bugs/moddata_2/bug353 deleted file mode 100755 index c1642344f5..0000000000 --- a/tests/bugs/moddata_2/bug353 +++ /dev/null @@ -1,16 +0,0 @@ -pload QAcommands - -puts "================" -puts "OCC353" -puts "================" -puts "" -########################################################## -## Attached DRAW command hangs in Geom2dGcc_Circ2d3Tan. -########################################################## - -if [catch { OCC353 }] { - puts "OCC353: Error" -} else { - puts "OCC353: OK" -} - diff --git a/tests/bugs/moddata_3/bug30704 b/tests/bugs/moddata_3/bug30704 deleted file mode 100644 index 244018eec2..0000000000 --- a/tests/bugs/moddata_3/bug30704 +++ /dev/null @@ -1,15 +0,0 @@ -puts "============" -puts "0030704: Oriented bounding box (Bnd_OBB) gives a wrong result if a box is added to a void box" -puts "============" - -pload QAcommands - -set ret1 [OCC30704] -if { ${ret1} != "150 150 150" } { - puts "Error: add bounding box to void bounding box" -} - -set ret2 [OCC30704_1] -if { ${ret2} != "100 200 300" } { - puts "Error: add point to void bounding box" -} diff --git a/tests/bugs/xde/bug23595 b/tests/bugs/xde/bug23595 deleted file mode 100755 index 2008a36069..0000000000 --- a/tests/bugs/xde/bug23595 +++ /dev/null @@ -1,11 +0,0 @@ -puts "============" -puts "OCC23595" -puts "============" -puts "" -####################################################################### -# XCAFDoc_ShapeTool extended with two methods - SetAutoNaming() and AutoNaming() -####################################################################### - -pload QAcommands - -OCC23595 -- 2.39.5