public void CloneTest() { var exp = new SubAssign(Variable.X, new Number(2)); var clone = exp.Clone(); Assert.Equal(exp, clone); }
public void BoolSubNumberTest() { var parameters = new ParameterCollection() { new Parameter("x", true) }; var add = new SubAssign(Variable.X, new Number(2)); Assert.Throws <NotSupportedException>(() => add.Execute(parameters)); }
public void SubAssignCalc() { var parameters = new ParameterCollection() { new Parameter("x", 10) }; var sub = new SubAssign(Variable.X, new Number(2)); var result = sub.Execute(parameters); var expected = 8.0; Assert.Equal(expected, result); Assert.Equal(expected, parameters["x"]); }
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns> /// The result of analysis. /// </returns> /// <exception cref="System.NotSupportedException">Always.</exception> public virtual TResult Analyze(SubAssign exp) { throw new NotSupportedException(); }
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns>The result of analysis.</returns> public string Analyze(SubAssign exp) { return(ToString(exp, "{0} -= {1}")); }
public void SubAssignToString() { var exp = new SubAssign(Variable.X, new Number(5)); Assert.Equal("x -= 5", exp.ToString(commoonFormatter)); }
public void TestSubAssignException() { var exp = new SubAssign(Variable.X, new Bool(false)); TestException(exp); }
public void TestSubAssignNumber() { var exp = new SubAssign(Variable.X, new Number(10)); Test(exp, ResultType.Number); }
public void TestSubAssignUndefined() { var exp = new SubAssign(Variable.X, Variable.X); Test(exp, ResultType.Undefined); }