use of com.alibaba.druid.sql.ast.expr.SQLUnaryExpr in project druid by alibaba.
the class EqualTest_unary_mysql method test_exits.
public void test_exits() throws Exception {
String sql = "-a";
String sql_c = "-(a+1 + +(b+1))";
SQLUnaryExpr exprA, exprB, exprC;
{
MySqlExprParser parser = new MySqlExprParser(sql);
exprA = (SQLUnaryExpr) parser.expr();
}
{
MySqlExprParser parser = new MySqlExprParser(sql);
exprB = (SQLUnaryExpr) parser.expr();
}
{
MySqlExprParser parser = new MySqlExprParser(sql_c);
exprC = (SQLUnaryExpr) parser.expr();
}
Assert.assertEquals(exprA, exprB);
Assert.assertNotEquals(exprA, exprC);
Assert.assertTrue(exprA.equals(exprA));
Assert.assertFalse(exprA.equals(new Object()));
Assert.assertEquals(exprA.hashCode(), exprB.hashCode());
Assert.assertEquals(new SQLUnaryExpr(), new SQLUnaryExpr());
Assert.assertEquals(new SQLUnaryExpr().hashCode(), new SQLUnaryExpr().hashCode());
}
use of com.alibaba.druid.sql.ast.expr.SQLUnaryExpr in project druid by alibaba.
the class PolygonTest method test_timestamp.
public void test_timestamp() throws Exception {
String sql = "# '((1,0),(0,1),(-1,0))'";
PGExprParser parser = new PGExprParser(sql);
SQLUnaryExpr unaryExpr = (SQLUnaryExpr) parser.expr();
Assert.assertEquals(SQLUnaryOperator.Pound, unaryExpr.getOperator());
}
Aggregations