|
@@ -231,6 +231,10 @@ type
|
|
procedure TestOr;
|
|
procedure TestOr;
|
|
procedure TestNotOr;
|
|
procedure TestNotOr;
|
|
procedure TestCase;
|
|
procedure TestCase;
|
|
|
|
+ procedure TestAdd;
|
|
|
|
+ procedure TestSubtract;
|
|
|
|
+ procedure TestMultiply;
|
|
|
|
+ procedure TestDivide;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TTestDomainParser }
|
|
{ TTestDomainParser }
|
|
@@ -2122,6 +2126,19 @@ begin
|
|
AssertLiteralExpr('Right is string',B.Right,TSQLStringLiteral);
|
|
AssertLiteralExpr('Right is string',B.Right,TSQLStringLiteral);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TTestCheckParser.TestDivide;
|
|
|
|
+
|
|
|
|
+Var
|
|
|
|
+ B : TSQLBinaryExpression;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ B:=TSQLBinaryExpression(TestCheck('VALUE / 1',TSQLBinaryExpression));
|
|
|
|
+ AssertEquals('Correct operator', boDivide, B.Operation);
|
|
|
|
+ AssertLiteralExpr('Left is value',B.Left,TSQLValueLiteral);
|
|
|
|
+ AssertLiteralExpr('Right is integer',B.Right,TSQLIntegerLiteral);
|
|
|
|
+ AssertEquals('Right is 1',1, TSQLIntegerLiteral(TSQLLiteralExpression(B.Right).Literal).Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TTestCheckParser.TestNotContaining;
|
|
procedure TTestCheckParser.TestNotContaining;
|
|
|
|
|
|
Var
|
|
Var
|
|
@@ -2176,6 +2193,19 @@ begin
|
|
AssertLiteralExpr('Right is string',B.Right,TSQLStringLiteral);
|
|
AssertLiteralExpr('Right is string',B.Right,TSQLStringLiteral);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TTestCheckParser.TestSubtract;
|
|
|
|
+
|
|
|
|
+Var
|
|
|
|
+ B : TSQLBinaryExpression;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ B:=TSQLBinaryExpression(TestCheck('VALUE - 1',TSQLBinaryExpression));
|
|
|
|
+ AssertEquals('Correct operator', boSubtract, B.Operation);
|
|
|
|
+ AssertLiteralExpr('Left is value',B.Left,TSQLValueLiteral);
|
|
|
|
+ AssertLiteralExpr('Right is integer',B.Right,TSQLIntegerLiteral);
|
|
|
|
+ AssertEquals('Right is 1',1, TSQLIntegerLiteral(TSQLLiteralExpression(B.Right).Literal).Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TTestCheckParser.TestNotStartingWith;
|
|
procedure TTestCheckParser.TestNotStartingWith;
|
|
|
|
|
|
Var
|
|
Var
|
|
@@ -2263,6 +2293,19 @@ begin
|
|
AssertLiteralExpr('Right is string',T.Right,TSQLStringLiteral);
|
|
AssertLiteralExpr('Right is string',T.Right,TSQLStringLiteral);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TTestCheckParser.TestMultiply;
|
|
|
|
+
|
|
|
|
+Var
|
|
|
|
+ B : TSQLBinaryExpression;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ B:=TSQLBinaryExpression(TestCheck('VALUE * 1',TSQLBinaryExpression));
|
|
|
|
+ AssertEquals('Correct operator', boMultiply, B.Operation);
|
|
|
|
+ AssertLiteralExpr('Left is value',B.Left,TSQLValueLiteral);
|
|
|
|
+ AssertLiteralExpr('Right is integer',B.Right,TSQLIntegerLiteral);
|
|
|
|
+ AssertEquals('Right is 1',1, TSQLIntegerLiteral(TSQLLiteralExpression(B.Right).Literal).Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TTestCheckParser.TestNotLikeEscape;
|
|
procedure TTestCheckParser.TestNotLikeEscape;
|
|
Var
|
|
Var
|
|
U : TSQLUnaryExpression;
|
|
U : TSQLUnaryExpression;
|
|
@@ -2279,6 +2322,19 @@ begin
|
|
AssertLiteralExpr('Right is string',T.Right,TSQLStringLiteral);
|
|
AssertLiteralExpr('Right is string',T.Right,TSQLStringLiteral);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TTestCheckParser.TestAdd;
|
|
|
|
+
|
|
|
|
+Var
|
|
|
|
+ B : TSQLBinaryExpression;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ B:=TSQLBinaryExpression(TestCheck('VALUE + 1',TSQLBinaryExpression));
|
|
|
|
+ AssertEquals('Correct operator', boAdd, B.Operation);
|
|
|
|
+ AssertLiteralExpr('Left is value',B.Left,TSQLValueLiteral);
|
|
|
|
+ AssertLiteralExpr('Right is integer',B.Right,TSQLIntegerLiteral);
|
|
|
|
+ AssertEquals('Right is 1',1, TSQLIntegerLiteral(TSQLLiteralExpression(B.Right).Literal).Value);
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TTestCheckParser.TestAnd;
|
|
procedure TTestCheckParser.TestAnd;
|
|
|
|
|
|
Var
|
|
Var
|