CompareEndpoints() public method

public CompareEndpoints ( TextPatternRangeEndpoint endpoint, TextPatternRange targetRange, TextPatternRangeEndpoint targetEndpoint ) : int
endpoint TextPatternRangeEndpoint
targetRange TextPatternRange
targetEndpoint TextPatternRangeEndpoint
return int
Ejemplo n.º 1
0
        //---------------------------------------------------------------------------
        // 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++;
        }
Ejemplo n.º 2
0
        //---------------------------------------------------------------------------
        // Wrapper for TextPatternRange.CompareEndpoints Method
        //---------------------------------------------------------------------------
        internal void Range_CompareEndpoints(TextPatternRange callingRange, TextPatternRangeEndpoint endPoint, TextPatternRange argumentRange, TextPatternRangeEndpoint targetEndPoint, ref int result, Type expectedException, CheckType checkType)
        {
            string call = "TextPatternRange.CompareEndpoints(" + endPoint + ", " + argumentRange + ", " + targetEndPoint + ")";

            if (callingRange == null)
                throw new ArgumentNullException(call + " requires non-NULL TextPatterncallingRange");

            try
            {
                result = callingRange.CompareEndpoints(endPoint, argumentRange, targetEndPoint);
                Comment("---Called " + call + " returning " + result);
            }
            catch (Exception actualException)
            {
                if (Library.IsCriticalException(actualException))
                    throw;

                Comment("---Calling " + call); // No results, so let user know we made the call

                TestException(expectedException, actualException, call, checkType);
                return;
            }
            TestNoExceptionQuiet(expectedException, call, checkType);
        }