コード例 #1
0
        public void TestExtractionInsertion_Multiplication()
        {
            string eEquation1 = "2*x=8";
            string expected   = "x = 4";

            Equation exp = MathParser.ParseEquation(eEquation1);

            Print(exp.ToString());

            OperatorExpressionPair pair = exp.LeftHandSide.Extract((IOperator)exp.LeftHandSide.TokenAt(1), (ITerm)exp.LeftHandSide.TokenAt(0));

            Print(exp.ToString());
            Print("Extracted: " + pair.ToString());

            exp.RightHandSide.Insert(pair);
            Print(exp.ToString());

            exp.RightHandSide.Simplify();
            Print(exp.ToString());

            Assert.AreEqual(expected, exp.ToString());
        }