[tarantool-patches] [PATCH v2 14/15] sql: support -2^63 .. 2^64-1 integer type
Stanislav Zudin
szudin at tarantool.org
Mon Apr 1 23:44:52 MSK 2019
Adds tests.
Part of #3810
---
test/sql-tap/func.test.lua | 14 +++++++++++++-
test/sql/gh-2347-max-int-literals.result | 9 +++++++++
test/sql/gh-2347-max-int-literals.test.lua | 4 ++++
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index c77b183db..1f328edb4 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -1,6 +1,6 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(14586)
+test:plan(14587)
--!./tcltestrunner.lua
-- 2001 September 15
@@ -1602,6 +1602,7 @@ test:do_execsql_test(
-- </func-18.12>
})
+
test:do_execsql_test(
"func-18.13",
[[
@@ -1612,6 +1613,17 @@ test:do_execsql_test(
-- </func-18.13>
})
+test:do_execsql_test(
+ "func-18.12a",
+ [[
+ INSERT INTO t6 VALUES(4, 13+ (1<<62));
+ SELECT avg(x) from t6;
+ ]], {
+ -- <func-18.12>
+ 3458764513820540928
+ -- </func-18.12>
+ })
+
test:do_execsql_test(
"func-18.14",
[[
diff --git a/test/sql/gh-2347-max-int-literals.result b/test/sql/gh-2347-max-int-literals.result
index e6f78d244..f12fab708 100644
--- a/test/sql/gh-2347-max-int-literals.result
+++ b/test/sql/gh-2347-max-int-literals.result
@@ -26,3 +26,12 @@ box.sql.execute("select (-9223372036854775809)")
---
- error: 'oversized integer: -9223372036854775809'
...
+-- cause an overflow
+box.sql.execute("select (92233720368547758080)")
+---
+- error: 'oversized integer: 92233720368547758080'
+...
+box.sql.execute("select (-92233720368547758090)")
+---
+- error: 'oversized integer: -92233720368547758090'
+...
diff --git a/test/sql/gh-2347-max-int-literals.test.lua b/test/sql/gh-2347-max-int-literals.test.lua
index 4b1ef0d4f..7106158a9 100644
--- a/test/sql/gh-2347-max-int-literals.test.lua
+++ b/test/sql/gh-2347-max-int-literals.test.lua
@@ -9,3 +9,7 @@ box.sql.execute("select (-9223372036854775808)")
box.sql.execute("select (9223372036854775808)")
box.sql.execute("select (-9223372036854775809)")
+
+-- cause an overflow
+box.sql.execute("select (92233720368547758080)")
+box.sql.execute("select (-92233720368547758090)")
--
2.17.1
More information about the Tarantool-patches
mailing list