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