return 0;
}
+//=======================================================================
+//function : QAStartsWith string startstring
+//=======================================================================
+static Standard_Integer QAStartsWith(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n == 3)
+ {
+ TCollection_ExtendedString str = a[1];
+ TCollection_ExtendedString startstr = a[2];
+ if (str.StartsWith(startstr))
+ di << "Yes";
+ else
+ di << "No";
+ return 0;
+ }
+ std::cerr << "Syntax error\n";
+ return 1;
+}
+
+//=======================================================================
+//function : QAEndsWith string endstring
+//=======================================================================
+static Standard_Integer QAEndsWith(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+ if (n == 3)
+ {
+ TCollection_ExtendedString str = a[1];
+ TCollection_ExtendedString endstr = a[2];
+ if (str.EndsWith(endstr))
+ di << "Yes";
+ else
+ di << "No";
+ return 0;
+ }
+ std::cerr << "Syntax error\n";
+ return 1;
+}
+
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
theCommands.Add("OCC29311", "OCC29311 shape counter nbiter: check performance of OBB calculation", __FILE__, OCC29311, group);
theCommands.Add("OCC30391", "OCC30391 result face LenBeforeUfirst LenAfterUlast LenBeforeVfirst LenAfterVlast", __FILE__, OCC30391, group);
+ theCommands.Add("QAStartsWith",
+ "QAStartsWith string startstring",
+ __FILE__, QAStartsWith, group);
+
+ theCommands.Add("QAEndsWith",
+ "QAEndsWith string endstring",
+ __FILE__, QAEndsWith, group);
+
return;
}
}
return mylength >= theStartString.mylength
- && memcmp (theStartString.mystring, mystring, theStartString.mylength) == 0;
+ && memcmp (theStartString.mystring, mystring, theStartString.mylength * sizeof(Standard_ExtCharacter)) == 0;
}
// ----------------------------------------------------------------------------
}
return mylength >= theEndString.mylength
- && memcmp (theEndString.mystring, mystring + mylength - theEndString.mylength, theEndString.mylength) == 0;
+ && memcmp (theEndString.mystring, mystring + mylength - theEndString.mylength, theEndString.mylength * sizeof(Standard_ExtCharacter)) == 0;
}
// ----------------------------------------------------------------------------
--- /dev/null
+puts "============"
+puts "0030536: Foundation Classes - TCollection_ExtendedString::StartsWith() and EndsWith() have a mistake"
+puts "============"
+
+pload QAcommands
+
+set ret1 [QAStartsWith hello help]
+if { ${ret1} == "Yes" } {
+ puts "Error"
+}
+
+set ret2 [QAStartsWith hello he]
+if { ${ret2} == "No" } {
+ puts "Error"
+}
+
+set ret3 [QAEndsWith hello ll]
+if { ${ret3} == "Yes" } {
+ puts "Error"
+}
+
+set ret4 [QAEndsWith hello lo]
+if { ${ret4} == "No" } {
+ puts "Error"
+}