@@ -16,6 +16,7 @@ package expression
1616
1717import (
1818 "fmt"
19+ "math"
1920 "testing"
2021 "time"
2122
@@ -568,7 +569,9 @@ func TestUnaryMinus(t *testing.T) {
568569 typ sql.Type
569570 expected interface {}
570571 }{
571- {"int32" , int32 (1 ), types .Int32 , int32 (- 1 )},
572+ {"int8" , int8 (1 ), types .Int8 , int64 (- 1 )},
573+ {"int16" , int16 (1 ), types .Int16 , int64 (- 1 )},
574+ {"int32" , int32 (1 ), types .Int32 , int64 (- 1 )},
572575 {"uint32" , uint32 (1 ), types .Uint32 , int32 (- 1 )},
573576 {"int64" , int64 (1 ), types .Int64 , int64 (- 1 )},
574577 {"uint64" , uint64 (1 ), types .Uint64 , int64 (- 1 )},
@@ -577,6 +580,10 @@ func TestUnaryMinus(t *testing.T) {
577580 {"int text" , "1" , types .LongText , "-1" },
578581 {"float text" , "1.2" , types .LongText , "-1.2" },
579582 {"nil" , nil , types .LongText , nil },
583+ {"minint8" , int8 (math .MinInt8 ), types .Int8 , int64 (128 )},
584+ {"minint16" , int16 (math .MinInt16 ), types .Int16 , int64 (32768 )},
585+ {"minint32" , int32 (math .MinInt32 ), types .Int32 , int64 (2147483648 )},
586+ {"minint64" , int64 (math .MinInt64 ), types .Int64 , "9223372036854775808" },
580587 }
581588
582589 for _ , tt := range testCases {
0 commit comments