public void Ceil() { double x = 1.5; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Ceil(x); Assert.AreEqual(Math.Ceiling(x), result); }
public void Sqrt() { double x = 1; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Sqrt(x); Assert.AreEqual(Math.Sqrt(x), result); }
public void Floor() { double x = 1.5; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Floor(x); Assert.AreEqual(Math.Floor(x), result); }
public void Add() { double x = 1; double y = 2; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Add(x, y); Assert.AreEqual(x + y, result); }
public void Remainder() { double x = 1; double y = 2; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Remainder(x, y); Assert.AreEqual(x % y, result); }
public void Pow() { double x = 1; double y = 2; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Pow(x, y); Assert.AreEqual(Math.Pow(x, y), result); }
public void Divide() { double x = 1; double y = 2; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Divide(x, y); Assert.AreEqual(x / y, result); }
public void Multiply() { double x = 1; double y = 2; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Multiply(x, y); Assert.AreEqual(x * y, result); }
public void Subtract() { double x = 1; double y = 2; DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); double result = callbacks.Subtract(x, y); Assert.AreEqual(x - y, result); }
public void Evaluate_Callbacks() { ArithmeticExpression ae = ArithmeticExpression.Parse("(+1) * (-2) * 3"); DotNetOperatorCallbacks callbacks = new DotNetOperatorCallbacks(); ae.Callbacks = callbacks; double result = ae.Evaluate(0); Assert.AreEqual((+1) * (-2) * 3, result); Assert.AreEqual(callbacks, ae.Callbacks); Assert.IsFalse(callbacks.IsDisposed); callbacks.Dispose(); Assert.IsTrue(callbacks.IsDisposed); }