@@ -36,15 +36,16 @@ func TestCeil(t *testing.T) {
3636 {"float64 is nil" , types .Float64 , sql .NewRow (nil ), nil , nil },
3737 {"float64 is ok" , types .Float64 , sql .NewRow (5.8 ), float64 (6 ), nil },
3838 {"float32 is nil" , types .Float32 , sql .NewRow (nil ), nil , nil },
39- {"float32 is ok" , types .Float32 , sql .NewRow (float32 (5.8 )), float32 (6 ), nil },
39+ {"float32 is ok" , types .Float32 , sql .NewRow (float32 (5.8 )), float64 (6 ), nil },
4040 {"int32 is nil" , types .Int32 , sql .NewRow (nil ), nil , nil },
41- {"int32 is ok" , types .Int32 , sql .NewRow (int32 (6 )), int32 (6 ), nil },
41+ {"int32 is ok" , types .Int32 , sql .NewRow (int32 (6 )), int64 (6 ), nil },
4242 {"int64 is nil" , types .Int64 , sql .NewRow (nil ), nil , nil },
4343 {"int64 is ok" , types .Int64 , sql .NewRow (int64 (6 )), int64 (6 ), nil },
4444 {"blob is nil" , types .Blob , sql .NewRow (nil ), nil , nil },
45- {"blob is ok" , types .Blob , sql .NewRow ([]byte {1 , 2 , 3 }), int32 (66051 ), nil },
46- {"string int is ok" , types .Text , sql .NewRow ("1" ), int32 (1 ), nil },
47- {"string float is ok" , types .Text , sql .NewRow ("1.2" ), int32 (2 ), nil },
45+ {"blob is ok" , types .Blob , sql .NewRow ([]byte {1 , 2 , 3 }), float64 (66051 ), nil },
46+ {"string int is ok" , types .Text , sql .NewRow ("1" ), float64 (1 ), nil },
47+ {"string float is ok" , types .Text , sql .NewRow ("1.2" ), float64 (2 ), nil },
48+ {"invalid strings are truncated but still ok" , types .Text , sql .NewRow ("1.2abc" ), float64 (2 ), nil },
4849 }
4950
5051 for _ , tt := range testCases {
@@ -65,7 +66,15 @@ func TestCeil(t *testing.T) {
6566 require .Equal (tt .expected , result )
6667 }
6768
68- require .True (types .IsInteger (f .Type ()))
69+ // signed -> signed, unsigned -> unsigned, everything else -> double
70+ resType := f .Type ()
71+ if types .IsSigned (tt .rowType ) {
72+ require .True (types .IsSigned (resType ))
73+ } else if types .IsUnsigned (resType ) {
74+ require .True (types .IsUnsigned (resType ))
75+ } else {
76+ require .True (types .IsFloat (resType ))
77+ }
6978 require .False (f .IsNullable ())
7079 })
7180 }
0 commit comments