@@ -91,15 +91,16 @@ func TestFloor(t *testing.T) {
9191 {"float64 is nil" , types .Float64 , sql .NewRow (nil ), nil , nil },
9292 {"float64 is ok" , types .Float64 , sql .NewRow (5.8 ), float64 (5 ), nil },
9393 {"float32 is nil" , types .Float32 , sql .NewRow (nil ), nil , nil },
94- {"float32 is ok" , types .Float32 , sql .NewRow (float32 (5.8 )), float32 (5 ), nil },
94+ {"float32 is ok" , types .Float32 , sql .NewRow (float32 (5.8 )), float64 (5 ), nil },
9595 {"int32 is nil" , types .Int32 , sql .NewRow (nil ), nil , nil },
96- {"int32 is ok" , types .Int32 , sql .NewRow (int32 (6 )), int32 (6 ), nil },
96+ {"int32 is ok" , types .Int32 , sql .NewRow (int32 (6 )), int64 (6 ), nil },
9797 {"int64 is nil" , types .Int64 , sql .NewRow (nil ), nil , nil },
9898 {"int64 is ok" , types .Int64 , sql .NewRow (int64 (6 )), int64 (6 ), nil },
9999 {"blob is nil" , types .Blob , sql .NewRow (nil ), nil , nil },
100- {"blob is ok" , types .Blob , sql .NewRow ([]byte {1 , 2 , 3 }), int32 (66051 ), nil },
101- {"string int is ok" , types .Text , sql .NewRow ("1" ), int32 (1 ), nil },
102- {"string float is ok" , types .Text , sql .NewRow ("1.2" ), int32 (1 ), nil },
100+ {"blob is ok" , types .Blob , sql .NewRow ([]byte {1 , 2 , 3 }), float64 (66051 ), nil },
101+ {"string int is ok" , types .Text , sql .NewRow ("1" ), float64 (1 ), nil },
102+ {"string float is ok" , types .Text , sql .NewRow ("1.2" ), float64 (1 ), nil },
103+ {"invalid strings are truncated but still ok" , types .Text , sql .NewRow ("1.2abc" ), float64 (1 ), nil },
103104 }
104105
105106 for _ , tt := range testCases {
@@ -120,7 +121,15 @@ func TestFloor(t *testing.T) {
120121 require .Equal (tt .expected , result )
121122 }
122123
123- require .True (types .IsInteger (f .Type ()))
124+ // signed -> signed, unsigned -> unsigned, everything else -> double
125+ resType := f .Type ()
126+ if types .IsSigned (tt .rowType ) {
127+ require .True (types .IsSigned (resType ))
128+ } else if types .IsUnsigned (resType ) {
129+ require .True (types .IsUnsigned (resType ))
130+ } else {
131+ require .True (types .IsFloat (resType ))
132+ }
124133 require .False (f .IsNullable ())
125134 })
126135 }
0 commit comments