/ Check-in [4b6af774]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the orderby9.test case so that it works with 32-bit versions of TCL
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4b6af7743034546a407a3e4722645945a4efc8a1
User & Date: drh 2015-09-18 14:42:48
Context
2015-09-18
14:45
Ensure that "PRAGMA integrity_check" reports an error if the free-list count header field contains a value smaller than the actual number of pages on the database free-list. check-in: 26f64986 user: dan tags: trunk
14:42
Fix the orderby9.test case so that it works with 32-bit versions of TCL check-in: 4b6af774 user: drh tags: trunk
14:22
Remove a test made obsolete by the ONEPASS DELETE optimization. check-in: c88b62c2 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/orderby9.test.

23
24
25
26
27
28
29










30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
do_execsql_test setup {
  -- create a table with many entries
  CREATE TABLE t1(x);
  WITH RECURSIVE
     c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
  INSERT INTO t1 SELECT x FROM c;
}










do_test 1.0 {
  set l1 {}
  # If random() is only evaluated once and then reused for each row, then
  # the output should appear in sorted order.  If random() is evaluated 
  # separately for the result set and the ORDER BY clause, then the output
  # order will be random.
  db eval {SELECT random() AS y FROM t1 ORDER BY 1;} {lappend l1 $y}
  expr {$l1==[lsort -int $l1]}
} {1}

do_test 1.1 {
  set l1 {}
  db eval {SELECT random() AS y FROM t1 ORDER BY random();} {lappend l1 $y}
  expr {$l1==[lsort -int $l1]}
} {1}

do_test 1.2 {
  set l1 {}
  db eval {SELECT random() AS y FROM t1 ORDER BY +random();} {lappend l1 $y}
  expr {$l1==[lsort -int $l1]}
} {0}

finish_test







>
>
>
>
>
>
>
>
>
>







|





|





|



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
do_execsql_test setup {
  -- create a table with many entries
  CREATE TABLE t1(x);
  WITH RECURSIVE
     c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
  INSERT INTO t1 SELECT x FROM c;
}

# Some versions of TCL are unable to [lsort -int] for
# 64-bit integers.  So we write our own comparison
# routine.
proc bigintcompare {a b} {
  set x [expr {$a-$b}]
  if {$x<0} {return -1}
  if {$x>0} {return +1}
  return 0
}
do_test 1.0 {
  set l1 {}
  # If random() is only evaluated once and then reused for each row, then
  # the output should appear in sorted order.  If random() is evaluated 
  # separately for the result set and the ORDER BY clause, then the output
  # order will be random.
  db eval {SELECT random() AS y FROM t1 ORDER BY 1;} {lappend l1 $y}
  expr {$l1==[lsort -command bigintcompare $l1]}
} {1}

do_test 1.1 {
  set l1 {}
  db eval {SELECT random() AS y FROM t1 ORDER BY random();} {lappend l1 $y}
  expr {$l1==[lsort -command bigintcompare $l1]}
} {1}

do_test 1.2 {
  set l1 {}
  db eval {SELECT random() AS y FROM t1 ORDER BY +random();} {lappend l1 $y}
  expr {$l1==[lsort -command bigintcompare $l1]}
} {0}

finish_test