Exemple #1
0
        public void CloneTest()
        {
            var exp   = new DivAssign(Variable.X, new Number(2));
            var clone = exp.Clone();

            Assert.Equal(exp, clone);
        }
Exemple #2
0
        public void BoolDivNumberTest()
        {
            var parameters = new ParameterCollection()
            {
                new Parameter("x", true)
            };
            var add = new DivAssign(Variable.X, new Number(2));

            Assert.Throws <NotSupportedException>(() => add.Execute(parameters));
        }
Exemple #3
0
        public void DivAssignCalc()
        {
            var parameters = new ParameterCollection()
            {
                new Parameter("x", 10)
            };
            var div      = new DivAssign(Variable.X, new Number(2));
            var result   = div.Execute(parameters);
            var expected = 5.0;

            Assert.Equal(expected, result);
            Assert.Equal(expected, parameters["x"]);
        }
Exemple #4
0
 /// <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(DivAssign exp)
 {
     throw new NotSupportedException();
 }
Exemple #5
0
 /// <summary>
 /// Analyzes the specified expression.
 /// </summary>
 /// <param name="exp">The expression.</param>
 /// <returns>The result of analysis.</returns>
 public string Analyze(DivAssign exp)
 {
     return(ToString(exp, "{0} /= {1}"));
 }
        public void DivAssignToString()
        {
            var exp = new DivAssign(Variable.X, new Number(5));

            Assert.Equal("x /= 5", exp.ToString(commoonFormatter));
        }
Exemple #7
0
        public void TestDivAssignException()
        {
            var exp = new DivAssign(Variable.X, new Bool(false));

            TestException(exp);
        }
Exemple #8
0
        public void TestDivAssignNumber()
        {
            var exp = new DivAssign(Variable.X, new Number(10));

            Test(exp, ResultType.Number);
        }
Exemple #9
0
        public void TestDivAssignUndefined()
        {
            var exp = new DivAssign(Variable.X, Variable.X);

            Test(exp, ResultType.Undefined);
        }