Ejemplo n.º 1
0
            /// <summary>
            ///   Checks whether the model's invariant holds for all states.
            /// </summary>
            public void Check()
            {
                _states = _context._states;

                try
                {
                    while (_context._loadBalancer.LoadBalance(_index))
                    {
                        int state;
                        if (!_stateStack.TryGetState(out state))
                        {
                            continue;
                        }

                        _transitions.Clear();
                        _model.ComputeSuccessorStates(_transitions, _states[state]);
                        AddStates();

                        InterlockedExchangeIfGreaterThan(ref _context._levelCount, _stateStack.FrameCount, _stateStack.FrameCount);
                        if (InterlockedExchangeIfGreaterThan(ref _context._nextReport, _context._stateCount, _context._nextReport + ReportStateCountDelta))
                        {
                            _context.Report();
                        }
                    }
                }
                catch (OutOfMemoryException e)
                {
                    _context._loadBalancer.Terminate();
                    _context._exception = e;
                }
                catch (Exception e)
                {
                    _context._loadBalancer.Terminate();
                    _context._exception = e;

                    CreateCounterExample(endsWithException: true);
                }
            }