github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/testdata/tcl/orderby8.test (about)

     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  
    19  set testdir [file dirname $argv0]
    20  source $testdir/tester.tcl
    21  set ::testprefix orderby8
    22  
    23  do_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}
    30  for {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  
    41  finish_test