-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: Convert 16 tests; add new test type; fix regexp result matching
sqltester: - Fix bug in regexp result matcher (last symbol was cut from regexp pattern) - Add new test type "do_select_tests" - Add procedure "drop_all_tables" Fixing bug in regexp result matching pointed to wrong success results in whereF test. These tests are commented by now. Part of #2381
- Loading branch information
1 parent
ca70128
commit 47b70d9
Showing
18 changed files
with
9,349 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env tarantool | ||
test = require("sqltester") | ||
test:plan(9999) | ||
|
||
--!./tcltestrunner.lua | ||
-- 2012 June 18 | ||
-- | ||
-- The author disclaims copyright to this source code. In place of | ||
-- a legal notice, here is a blessing: | ||
-- | ||
-- May you do good and not evil. | ||
-- May you find forgiveness for yourself and forgive others. | ||
-- May you share freely, never taking more than you give. | ||
-- | ||
------------------------------------------------------------------------- | ||
-- | ||
-- Tests of the sqlite3AtoF() function. | ||
-- | ||
-- ["set","testdir",[["file","dirname",["argv0"]]]] | ||
-- ["source",[["testdir"],"\/tester.tcl"]] | ||
|
||
|
||
for i = 1, 10000 - 1, 1 do | ||
local pow = math.random(100) | ||
local x = math.pow((math.random()-0.5)*2*math.random(), pow) | ||
|
||
-- Pointless test | ||
-- local xf = string.format("%.32e", x) | ||
-- print("\nxf "..xf.." x "..x) | ||
-- -- Verify that text->real conversions get exactly same ieee754 floating- | ||
-- -- point value in SQLite as they do in TCL. | ||
-- -- | ||
-- test:do_test( | ||
-- "atof1-1."..i..".1", | ||
-- function() | ||
-- local y = test:execsql("SELECT "..xf.."="..x) | ||
-- return y | ||
-- end, { | ||
-- 1 | ||
-- }) | ||
|
||
-- Verify that round-trip real->text->real conversions using the quote() | ||
-- function preserve the bits of the numeric value exactly. | ||
-- | ||
test:do_test( | ||
"atof1-1."..i..".2", | ||
function() | ||
local y = test:execsql(string.format("SELECT %s=CAST(quote(%s) AS real)",x, x)) | ||
return y | ||
end, { | ||
1 | ||
}) | ||
|
||
end | ||
|
||
|
||
test:finish_test() |
Oops, something went wrong.