20 using NUnit.Framework;
22 namespace Deveel.Data.Sql.Expressions {
25 [TestCase(4637377, 4637377)]
26 [TestCase(-1929934, -1929934)]
32 Assert.DoesNotThrow(() => resultExp = plusExp.
Evaluate());
33 Assert.IsNotNull(resultExp);
37 Assert.IsNotNull(constExp.Value.Value);
38 Assert.IsInstanceOf<
NumericType>(constExp.Value.Type);
39 Assert.IsInstanceOf<
SqlNumber>(constExp.Value.Value);
41 var actual = ((
SqlNumber)constExp.Value.Value);
42 var expectedResult =
new SqlNumber(expected);
43 Assert.AreEqual(expectedResult, actual);
46 [TestCase(884920009.9948, -884920009.9948)]
47 [TestCase(-92338.122, 92338.122)]
53 Assert.DoesNotThrow(() => resultExp = negExp.
Evaluate());
54 Assert.IsNotNull(resultExp);
58 Assert.IsNotNull(constExp.Value.Value);
59 Assert.IsInstanceOf<
NumericType>(constExp.Value.Type);
60 Assert.IsInstanceOf<
SqlNumber>(constExp.Value.Value);
62 var actual = ((
SqlNumber)constExp.Value.Value);
63 var expectedResult =
new SqlNumber(expected);
64 Assert.AreEqual(expectedResult, actual);
67 [TestCase(
true,
false)]
68 [TestCase(
false,
true)]
74 Assert.DoesNotThrow(() => resultExp = negExp.
Evaluate());
75 Assert.IsNotNull(resultExp);
79 Assert.IsNotNull(constExp.Value.Value);
80 Assert.IsInstanceOf<
BooleanType>(constExp.Value.Type);
81 Assert.IsInstanceOf<
SqlBoolean>(constExp.Value.Value);
83 var actual = ((
SqlBoolean)constExp.Value.Value);
85 Assert.AreEqual(expectedResult, actual);
void NumericPlus(double a, double expected)
static DataObject Number(SqlNumber value)
static DataObject Boolean(SqlBoolean value)
virtual SqlExpression Evaluate(EvaluateContext context)
When overridden by a derived class, this method evaluates the expression within the provided context...
void NumericNegate(double a, double expected)
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
static SqlUnaryExpression UnaryPlus(SqlExpression operand)
An expression that holds a constant value.
void BooleanNegate(bool a, bool expected)
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
static SqlUnaryExpression Negate(SqlExpression operand)