//---------------------------------------------------------------------------
// Compares the start and end points of two ranges to determine if they are identical
//---------------------------------------------------------------------------
static internal void TS_IsMatchingEndPoints(TextPatternRange range, TextPatternRange targetRange, bool expectMatch, CheckType checkType)
{
bool actualMatch;
int startPoint;
int endPoint;
string expectMatchString = (expectMatch == true ? "matches" : "doesn't match");
// Get start/end point offsets
startPoint = range.CompareEndpoints(TextPatternRangeEndpoint.Start, targetRange,
TextPatternRangeEndpoint.Start);
endPoint = range.CompareEndpoints(TextPatternRangeEndpoint.End, targetRange,
TextPatternRangeEndpoint.End);
// if the ranges Match than the return value of both calls to CompareEndPoints = 0
actualMatch = ((startPoint == 0) && (endPoint == 0));
Comment("Start point offset = " + startPoint + ", End point offset = " + endPoint + ", expected " +
(expectMatch == true
? "non-zero"
: "zero") +
" offsets");
// Report results
if (actualMatch == expectMatch)
Comment("Start/End point(s) " + expectMatchString + ", as expected");
else
{
ThrowMe(checkType, "Start/End point(s) " + expectMatchString + ", which is not expected result");
}
m_TestStep++;
}