Exemplo n.º 1
0
        // ******************************************************************
        /// <summary>
        /// Return true to continue, false to stop
        /// </summary>
        private ExecutionState Test()
        {
            try
            {
                _results = _funcConvexHull(_points);
                var diff = ConvexHullUtil.GetPathDifferences(_algoName, _points, _referenceResults, _results);
                diff.Hint = LatestTestName;
                if (_funcShouldStopTesting != null)
                {
                    return(_funcShouldStopTesting(diff));
                }
            }
            catch (Exception ex)
            {
                if (_funcShouldStopTesting != null)
                {
                    DifferencesInPath diff = new DifferencesInPath(_algoName, _points, _referenceResults, _results);
                    diff.Hint      = LatestTestName;
                    diff.Exception = ex;
                    return(_funcShouldStopTesting(diff));
                }
            }

            return(ExecutionState.Continue);
        }
Exemplo n.º 2
0
        // ******************************************************************
        /// <summary>
        ///
        /// </summary>
        /// <param name="indexesPosition"></param>
        /// <param name="testPoints"></param>
        /// <param name="expectedHullResult"></param>
        /// <returns>TRue if should continue testing or false to stop</returns>
        private ExecutionState TestConvexHull(Point[] points, Point[] expectedHullResult)
        {
            Global.Instance.Iteration++;

            IReadOnlyList <Point> convexHullPoints = _funcConvexHull(points);

            DifferencesInPath diffs = ConvexHullUtil.GetPathDifferences(_algoName, points, expectedHullResult, convexHullPoints);

            if (Global.Instance.IsCancel)
            {
                Global.Instance.ResetCancel();
                return(ExecutionState.Stop);                // Cancel
            }

            if (_funcShouldStopTesting != null)
            {
                return(_funcShouldStopTesting(diffs));
            }

            return(ExecutionState.Continue);
        }