Example #1
0
        public void Simplify_Calls_All_Passed_Simplifiers()
        {
            mChecker.IsEqual(Arg.Any <IExpression>(), Arg.Any <IExpression>()).Returns(true);
            var afterFirst = new Constant();
            var input      = new Constant();

            mFirstSimplifier.Simplify(input).Returns(afterFirst);
            mUnderTest.Simplify(input);

            mSecondSimplifier.Received().Simplify(afterFirst);
        }
Example #2
0
        public IExpression Simplify(IExpression input)
        {
            var  result = input;
            bool hasChanged;

            do
            {
                var transformed = ApplyAllSimplifications(result);
                hasChanged = !mChecker.IsEqual(result, transformed);
                if (hasChanged)
                {
                    result = transformed;
                }
            }while (hasChanged);
            return(result);
        }