Strictly type Integer and Real expressions.

This commit is contained in:
zer0sub 2019-05-31 12:59:57 +02:00
parent 7f5ba98819
commit 2b6288d317
32 changed files with 640 additions and 547 deletions

View file

@ -91,29 +91,29 @@ func TestBoolOperators(t *testing.T) {
func TestNumericOperators(t *testing.T) {
query := AllTypes.SELECT(
AllTypes.Numeric.EQ(AllTypes.Numeric),
AllTypes.Decimal.EQ(Int(12)),
AllTypes.Decimal.EQ(Float(12)),
AllTypes.Real.EQ(Float(12.12)),
AllTypes.Smallint.NOT_EQ(AllTypes.Real),
//AllTypes.Smallint.NOT_EQ(AllTypes.Real),
AllTypes.Integer.NOT_EQ(Int(12)),
AllTypes.Bigint.NOT_EQ(Float(12)),
AllTypes.Bigint.NOT_EQ(Int(12)),
AllTypes.Numeric.IS_DISTINCT_FROM(AllTypes.Numeric),
AllTypes.Decimal.IS_DISTINCT_FROM(Int(12)),
AllTypes.Decimal.IS_DISTINCT_FROM(Float(12)),
AllTypes.Real.IS_DISTINCT_FROM(Float(12.12)),
AllTypes.Numeric.IS_NOT_DISTINCT_FROM(AllTypes.Numeric),
AllTypes.Decimal.IS_NOT_DISTINCT_FROM(Int(12)),
AllTypes.Decimal.IS_NOT_DISTINCT_FROM(Float(12)),
AllTypes.Real.IS_NOT_DISTINCT_FROM(Float(12.12)),
AllTypes.Numeric.LT(AllTypes.Integer),
AllTypes.Numeric.LT(Int(124)),
//AllTypes.Numeric.LT(AllTypes.Integer),
AllTypes.Numeric.LT(Float(124)),
AllTypes.Numeric.LT(Float(34.56)),
AllTypes.Smallint.LT_EQ(AllTypes.Numeric),
//AllTypes.Smallint.LT_EQ(AllTypes.Numeric),
AllTypes.Integer.LT_EQ(Int(45)),
AllTypes.Bigint.LT_EQ(Float(65)),
AllTypes.Numeric.GT(AllTypes.Smallint),
AllTypes.Numeric.GT(Int(124)),
AllTypes.Bigint.LT_EQ(Int(65)),
//AllTypes.Numeric.GT(AllTypes.Smallint),
AllTypes.Numeric.GT(Float(124)),
AllTypes.Numeric.GT(Float(34.56)),
AllTypes.Smallint.GT_EQ(AllTypes.Numeric),
//AllTypes.Smallint.GT_EQ(AllTypes.Numeric),
AllTypes.Integer.GT_EQ(Int(45)),
AllTypes.Bigint.GT_EQ(Float(65)),
AllTypes.Bigint.GT_EQ(Int(65)),
)
fmt.Println(query.DebugSql())