xref: /sqlite-3.40.0/test/orderby8.test (revision 59b1b58b)
1*59b1b58bSdrh# 2015-01-19
2*59b1b58bSdrh#
3*59b1b58bSdrh# The author disclaims copyright to this source code.  In place of
4*59b1b58bSdrh# a legal notice, here is a blessing:
5*59b1b58bSdrh#
6*59b1b58bSdrh#    May you do good and not evil.
7*59b1b58bSdrh#    May you find forgiveness for yourself and forgive others.
8*59b1b58bSdrh#    May you share freely, never taking more than you give.
9*59b1b58bSdrh#
10*59b1b58bSdrh#***********************************************************************
11*59b1b58bSdrh# This file implements regression tests for SQLite library.  The
12*59b1b58bSdrh# focus of this file is testing ORDER BY and LIMIT on tables with
13*59b1b58bSdrh# many columns.
14*59b1b58bSdrh#
15*59b1b58bSdrh# These tests verify that ticket [f97c4637102a3ae72b7911167e1d4da12ce60722]
16*59b1b58bSdrh# from 2015-01-19 has been fixed.
17*59b1b58bSdrh#
18*59b1b58bSdrh
19*59b1b58bSdrhset testdir [file dirname $argv0]
20*59b1b58bSdrhsource $testdir/tester.tcl
21*59b1b58bSdrhset ::testprefix orderby8
22*59b1b58bSdrh
23*59b1b58bSdrhdo_test 1.0 {
24*59b1b58bSdrh  db eval {
25*59b1b58bSdrh    CREATE TABLE t1(x);
26*59b1b58bSdrh    INSERT INTO t1(x) VALUES(1),(5),(9),(7),(3),(2),(4),(6),(8);
27*59b1b58bSdrh  }
28*59b1b58bSdrh  set ::result_set "x"
29*59b1b58bSdrh} {x}
30*59b1b58bSdrhfor {set i 1} {$i<200} {incr i} {
31*59b1b58bSdrh  append ::result_set ", x+$i"
32*59b1b58bSdrh  do_test 1.$i {
33*59b1b58bSdrh    set res {}
34*59b1b58bSdrh    db eval "SELECT $::result_set FROM t1 ORDER BY x LIMIT -1" {
35*59b1b58bSdrh      lappend res $x
36*59b1b58bSdrh    }
37*59b1b58bSdrh    set res
38*59b1b58bSdrh  } {1 2 3 4 5 6 7 8 9}
39*59b1b58bSdrh}
40*59b1b58bSdrh
41*59b1b58bSdrhfinish_test
42