# 2015-11-05 # # 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. # #*********************************************************************** # This file implements tests for indexes on large numeric values. # set testdir [file dirname $argv0] source $testdir/tester.tcl # Test cases from Zsbán Ambrus: # do_execsql_test numindex1-1.1 { CREATE TABLE t1(a INTEGER PRIMARY KEY, b); CREATE INDEX t1b ON t1(b); INSERT INTO t1(a,b) VALUES(100, 356282677878746339); INSERT INTO t1(a,b) VALUES(50, 356282677878746339.0); INSERT INTO t1(a,b) VALUES(0, 356282677878746340); DELETE FROM t1 WHERE a=50; PRAGMA integrity_check; } {ok} do_execsql_test numindex1-1.2 { CREATE TABLE t2(a,b); INSERT INTO t2(a,b) VALUES('b', 1<<58), ('c', (1<<58)+1e-7), ('d', (1<<58)+1); SELECT a, b, typeof(b), '|' FROM t2 ORDER BY +a; } {b 288230376151711744 integer | c 2.88230376151712e+17 real | d 288230376151711745 integer |} do_execsql_test numindex1-1.3 { SELECT x.a || CASE WHEN x.b==y.b THEN '==' ELSE '<>' END || y.a FROM t2 AS x, t2 AS y ORDER BY +x.a, +x.b; } {b==b b==c b<>d c==b c==c c<>d d<>b d<>c d==d} finish_test