Skip to content

Commit 7c376be

Browse files
committed
add tests for negative infinity
1 parent 5bf483a commit 7c376be

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

memory/table_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,24 @@ func TestTableInsert(t *testing.T) {
107107
value: math.Inf(1),
108108
err: true,
109109
},
110+
{
111+
name: "inserting negative Infinity into float results in error",
112+
colType: types.Float64,
113+
value: math.Inf(-1),
114+
err: true,
115+
},
116+
{
117+
name: "inserting negative Infinity into int results in error",
118+
colType: types.Int64,
119+
value: math.Inf(-1),
120+
err: true,
121+
},
122+
{
123+
name: "inserting negative Infinity into Decimal results in error",
124+
colType: types.MustCreateDecimalType(types.DecimalTypeMaxPrecision, types.DecimalTypeMaxScale),
125+
value: math.Inf(-1),
126+
err: true,
127+
},
110128
}
111129

112130
for _, tc := range testCases {

sql/rowexec/insert_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ func TestInsert(t *testing.T) {
112112
value: math.Inf(1),
113113
err: true,
114114
},
115+
{
116+
name: "inserting negative Infinity into float results in error",
117+
colType: types.Float64,
118+
value: math.Inf(-1),
119+
err: true,
120+
},
121+
{
122+
name: "inserting negative Infinity into int results in error",
123+
colType: types.Int64,
124+
value: math.Inf(-1),
125+
err: true,
126+
},
127+
{
128+
name: "inserting negative Infinity into Decimal results in error",
129+
colType: types.MustCreateDecimalType(types.DecimalTypeMaxPrecision, types.DecimalTypeMaxScale),
130+
value: math.Inf(-1),
131+
err: true,
132+
},
115133
}
116134

117135
for _, tc := range testCases {

0 commit comments

Comments
 (0)