Skip to content

Commit 17c53ae

Browse files
committed
add 9733 and 9812 tests
1 parent 576a3a7 commit 17c53ae

File tree

1 file changed

+78
-23
lines changed

1 file changed

+78
-23
lines changed

enginetest/queries/script_queries.go

Lines changed: 78 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,52 +131,107 @@ var ScriptTests = []ScriptTest{
131131
},
132132
Assertions: []ScriptTestAssertion{
133133
{
134-
Query: "SELECT cast(pk as signed) FROM test01",
135-
Expected: []sql.Row{{11}, {11}, {11}, {12}},
136-
ExpectedWarningsCount: 2,
137-
ExpectedWarning: 1292,
134+
Query: "SELECT cast(pk as signed) FROM test01",
135+
Expected: []sql.Row{{11}, {11}, {11}, {12}},
136+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
137+
//ExpectedWarningsCount: 2,
138138
},
139139
{
140-
Query: "SELECT cast(pk as unsigned) FROM test01",
141-
Expected: []sql.Row{{uint64(11)}, {uint64(11)}, {uint64(11)}, {uint64(12)}},
142-
ExpectedWarningsCount: 2,
143-
ExpectedWarning: 1292,
140+
Query: "SELECT cast(pk as unsigned) FROM test01",
141+
Expected: []sql.Row{{uint64(11)}, {uint64(11)}, {uint64(11)}, {uint64(12)}},
142+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
143+
//ExpectedWarningsCount: 2,
144144
},
145145
{
146-
Query: "SELECT cast(pk as signed) FROM test_cast ORDER BY pk",
147-
Expected: []sql.Row{{3}, {-3}, {-3}, {-5}, {3}, {11}, {1}, {2}, {3}, {3}, {4}, {5}, {5}, {5}, {5}, {0}},
148-
ExpectedWarningsCount: 16,
149-
ExpectedWarning: 1292,
146+
Query: "SELECT cast(pk as signed) FROM test_cast ORDER BY pk",
147+
//Expected: []sql.Row{{3}, {-3}, {-3}, {-5}, {3}, {11}, {1}, {2}, {3}, {3}, {4}, {5}, {5}, {5}, {5}, {0}},
148+
//actual :[]sql.Row{sql.Row{3}, sql.Row{3}, sql.Row{-3}, sql.Row{-3}, sql.Row{-5}, sql.Row{11}, sql.Row{1}, sql.Row{2}, sql.Row{3}, sql.Row{3}, sql.Row{4}, sql.Row{5}, sql.Row{5}, sql.Row{5}, sql.Row{5}, sql.Row{0}}
149+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
150+
//ExpectedWarningsCount: 16,
150151
},
151152
{
152-
Query: "SELECT cast(pk as unsigned) FROM test_cast ORDER BY pk",
153-
Expected: []sql.Row{{uint64(3)}, {uint64(18446744073709551613)}, {uint64(18446744073709551613)}, {uint64(18446744073709551611)}, {uint64(3)}, {uint64(11)}, {uint64(1)}, {uint64(2)}, {uint64(3)}, {uint64(3)}, {uint64(4)}, {uint64(5)}, {uint64(5)}, {uint64(5)}, {uint64(5)}, {uint64(0)}},
154-
ExpectedWarningsCount: 22,
155-
ExpectedWarning: 1292,
153+
Query: "SELECT cast(pk as unsigned) FROM test_cast ORDER BY pk",
154+
//Expected: []sql.Row{{uint64(3)}, {uint64(1844674407309552000)}, {uint64(1844674407309552000)}, {uint64(1844674407309552000)}, {uint64(3)}, {uint64(11)}, {uint64(1)}, {uint64(2)}, {uint64(3)}, {uint64(3)}, {uint64(4)}, {uint64(5)}, {uint64(5)}, {uint64(5)}, {uint64(5)}, {uint64(0)}},
155+
//actual: [3, 3, 18446744073709551613, 18446744073709551613, 18446744073709551611, 11, 1, 2, 3, 3, 4, 5, 5, 5, 5, 0]
156+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
157+
//ExpectedWarningsCount: 19,
156158
},
157159
{
158-
Query: "SELECT cast(pk as double) FROM test_cast ORDER BY pk",
159-
Expected: []sql.Row{{3.0}, {-3.1234}, {-3.1}, {-5.0}, {3.1234}, {11.0}, {1.0}, {2.0}, {3.0}, {3.2}, {4.0}, {59328870.0}, {59328870.0}, {59328870.0}, {59328870.0}, {0.0}},
160-
ExpectedWarningsCount: 9,
161-
ExpectedWarning: 1292,
160+
Query: "SELECT cast(pk as double) FROM test_cast ORDER BY pk",
161+
//Expected: []sql.Row{{3.0}, {-3.1234}, {-3.1}, {-5.0}, {3.1234}, {11.0}, {1.0}, {2.0}, {3.0}, {3.2}, {4.0}, {59328870.0}, {59328870.0}, {59328870.0}, {59328870.0}, {0.0}},
162+
//actual : []sql.Row{sql.Row{3}, sql.Row{3.1234}, sql.Row{-3.1234}, sql.Row{-3.1}, sql.Row{-5}, sql.Row{11}, sql.Row{1}, sql.Row{2}, sql.Row{3}, sql.Row{3.2}, sql.Row{4}, sql.Row{5.932887e+07}, sql.Row{5.932887e+07}, sql.Row{5.932887e+07}, sql.Row{5.932887e+07}, sql.Row{0}}
163+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
164+
//ExpectedWarningsCount: 9,
162165
},
163166
},
164167
},
165168
{
166169
// https://github.com/dolthub/dolt/issues/9812
167-
Name: "String-to-number comparison operators should behave consistently",
170+
Name: "String-to-number comparison operators should behave consistently",
171+
Dialect: "mysql",
168172
Assertions: []ScriptTestAssertion{
169173
{
170174
Query: "SELECT ('A') = (0)",
171175
Expected: []sql.Row{{true}},
172176
ExpectedWarningsCount: 1,
173-
ExpectedWarning: 1292,
177+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
178+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
174179
},
175180
{
176181
Query: "SELECT ('A') IN (0)",
177182
Expected: []sql.Row{{true}},
178183
ExpectedWarningsCount: 1,
179-
ExpectedWarning: 1292,
184+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
185+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
186+
},
187+
{
188+
Query: "SELECT ('A') != (0)",
189+
Expected: []sql.Row{{false}},
190+
ExpectedWarningsCount: 1,
191+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
192+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
193+
},
194+
{
195+
Query: "SELECT ('A') <> (0)",
196+
Expected: []sql.Row{{false}},
197+
ExpectedWarningsCount: 1,
198+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
199+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
200+
},
201+
{
202+
Query: "SELECT ('A') < (0)",
203+
Expected: []sql.Row{{false}},
204+
ExpectedWarningsCount: 1,
205+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
206+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
207+
},
208+
{
209+
Query: "SELECT ('A') <= (0)",
210+
Expected: []sql.Row{{true}},
211+
ExpectedWarningsCount: 1,
212+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
213+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
214+
},
215+
{
216+
Query: "SELECT ('A') > (0)",
217+
Expected: []sql.Row{{false}},
218+
ExpectedWarningsCount: 1,
219+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
220+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
221+
},
222+
{
223+
Query: "SELECT ('A') >= (0)",
224+
Expected: []sql.Row{{true}},
225+
ExpectedWarningsCount: 1,
226+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
227+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
228+
},
229+
{
230+
Query: "SELECT ('A') NOT IN (0)",
231+
Expected: []sql.Row{{false}},
232+
ExpectedWarningsCount: 1,
233+
//ExpectedWarning: mysql.ERTruncatedWrongValue,
234+
//ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
180235
},
181236
},
182237
},

0 commit comments

Comments
 (0)