public void Sum_CollectConstants_SingleExpressionRemains() { var expression = Sum(2, 5, -7, "x"); var simplifier = new CollectNumbersInSumSimplifier(); var result = simplifier.Simplify(expression, CancellationToken.None); Assert.IsInstanceOfType(result, typeof(SymbolExpression)); }
public void Sum_CollectConstants_OnlyConstants() { var expression = Sum(2, 5, 7); var simplifier = new CollectNumbersInSumSimplifier(); var result = simplifier.Simplify(expression, CancellationToken.None); Assert.IsInstanceOfType(result, typeof(NumberExpression)); Assert.AreEqual(14, result.GetConstantValue()); }
public void Sum_CollectConstants() { var x = Symbol("x"); var expression = Sum(2, 5, x); var simplifier = new CollectNumbersInSumSimplifier(); var result = simplifier.Simplify(expression, CancellationToken.None); Assert.AreEqual(x + 7, result); }