1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026622: Tests - Avoid using dlog and decho commands in test scripts

Added possibility to define patterns that must be present in the test log, so that test is considered OK only if all these patterns are found.
New REQUIRED statement is introduced for that, documented in dox/dev_guides/tests/tests.md.

Removed all uses of decho and dlog commands, added REQUIRED where necessary.
Command xdistcs is modified to output to Tcl instead of cout, and extended to report errors and warnings if distances are greater than tolerance (directly, instead of complex post-processing on Tcl level).

DEBUG mode for TODOs was removed (we should have no deviations in Debug mode).

Corrected indentation in DrawResources/TestCommands.tcl

HTML log will now highlight TODO statement causing IMPROVEMENT status, or REQUIRED statement causing FAIL, by corresponding color.
This commit is contained in:
abv
2015-10-09 20:15:11 +03:00
committed by bugmaster
parent ee9e67edc7
commit 6d3685029f
144 changed files with 1195 additions and 2642 deletions

View File

@@ -297,10 +297,13 @@ static Standard_Integer xdistcc2ds(Draw_Interpretor& , Standard_Integer n, const
//function : xdistcs
//purpose :
//=======================================================================
static Standard_Integer xdistcs(Draw_Interpretor& , Standard_Integer n, const char** a)
static Standard_Integer xdistcs(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
if (n<5) {
cout<<" Use xdistcs c s t1 t2 nbp"<<endl;
if (n < 6) {
cout << "Use: xdistcs curve surface t1 t2 nbpoints [tol [warn_tol]]" << endl;
cout << "Measures distances from curve to surface by nbpoints probing points on a curve" << endl;
cout << "Error will be reported for points where distance is greater than tol" << endl;
cout << "Warning will be reported for points where distance is greater than warn_tol" << endl;
return 0;
}
//
@@ -318,13 +321,13 @@ static Standard_Integer xdistcs(Draw_Interpretor& , Standard_Integer n, const ch
//
aC=DrawTrSurf::GetCurve(a[1]);
if (aC.IsNull()) {
cout<<a[1]<<" is null curve"<<endl;
di << "Error: " << a[1] << " is not a curve!" << "\n";
return 0;
}
//
aS=DrawTrSurf::GetSurface(a[2]);
if (aS.IsNull()) {
cout<<a[2]<<" is null"<<endl;
di << "Error: " << a[2] << " is not a surface!" << "\n";
return 0;
}
//
@@ -335,6 +338,8 @@ static Standard_Integer xdistcs(Draw_Interpretor& , Standard_Integer n, const ch
if (n>5) {
aNbP=Draw::Atoi(a[5]);
}
Standard_Real anErrTol = (n > 6 ? Draw::Atof(a[6]) : RealLast());
Standard_Real aWarnTol = (n > 7 ? Draw::Atof(a[7]) : RealLast());
//
iSize=3;
//
@@ -349,12 +354,23 @@ static Standard_Integer xdistcs(Draw_Interpretor& , Standard_Integer n, const ch
aPPS.Init(aP, aS, aTol);
bRet=aPPS.IsDone();
if (!bRet) {
cout<<" GeomAPI_ProjectPointOnSurf failed"<<endl;
di << "Error: GeomAPI_ProjectPointOnSurf failed" << "\n";
return 0;
}
//
aD=aPPS.LowerDistance();
printf(" T=%lg\tD=%lg\n", aT, aD);
// report error or warning if distance is greater than tolerance
if (aD > anErrTol)
{
di << "Error :";
}
else if (aD > aWarnTol)
{
di << "Attention (critical value of tolerance) :";
}
char aMsg[256];
sprintf(aMsg," T=%lg\tD=%lg\n", aT, aD);
di << aMsg;
//
aMr=new Draw_Marker3D(aP, Draw_Plus, aColor, iSize);
dout << aMr;
@@ -381,7 +397,7 @@ void GeometryTest::TestProjCommands(Draw_Interpretor& theCommands)
g = "Testing of projection (geometric objects)";
theCommands.Add("xdistcs", "xdistcs c s t1 t2 nbp", __FILE__, xdistcs, g);
theCommands.Add("xdistcs", "xdistcs curve surface t1 t2 nbpoints [tol [warn_tol]]", __FILE__, xdistcs, g);
theCommands.Add("xdistcc2ds", "xdistcc2ds c c2d s t1 t2 nbp", __FILE__, xdistcc2ds, g);
theCommands.Add("xdistc2dc2dss", "xdistc2dc2dss c2d_1 c2d_2 s1 s2 t1 t2 nbp", __FILE__, xdistc2dc2dss, g);
theCommands.Add("xdistcc", "xdistcc c1 c2 t1 t2 nbp", __FILE__, xdistcc, g);