3 # Run this script to generate randomized test cases for the where7.test
4 # script. The output will need to be manually copied and pasted into
5 # the where7.test script.
7 puts "do_test where7-2.1 \173"
9 puts " CREATE TABLE t2(a INTEGER PRIMARY KEY,b,c,d,e,f,g);"
11 for {set a
1} {$a<=$NA} {incr a
} {
13 set div3
[expr {int
(($a+2)/3)}]
14 set c
[expr {$div3*1001}]
15 set d
[expr {$a*1.001}]
16 set e
[expr {$div3*100.1}]
18 set f
[string range
{abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
} \
20 set div5
[expr {int
(($a+7)/5)}]
21 set x
[expr {$div5%26}]
22 set g
[string range
{zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba
} \
24 puts " INSERT INTO t2 VALUES($a,$b,$c,$d,$e,'$f','$g');"
32 set expr "((a BETWEEN [expr {$a-1}] AND [expr {$a+1}]) AND a!=$a)"
34 if {$a>1} {set x
[expr {$a-1}]}
35 if {$a<$NA} {lappend x
[expr {$a+1}]}
39 set expr "b=[expr {$a*11+3}]"
42 lappend term
($expr) $a
43 set expr "(d>=$a.0 AND d<[expr {$a+1.0}] AND d NOT NULL)"
44 lappend term
($expr) $a
46 lappend term
($expr) $a
48 "(f GLOB '?[string range $f 1 4]*' AND f GLOB '[string range $f 0 3]*')"
49 lappend term
($expr) $a
50 set expr "(g='$g' AND f GLOB '[string range $f 0 4]*')"
51 lappend term
($expr) $a
53 puts " CREATE INDEX t2b ON t2(b);"
54 puts " CREATE INDEX t2c ON t2(c);"
55 puts " CREATE INDEX t2d ON t2(d);"
56 puts " CREATE INDEX t2e ON t2(e);"
57 puts " CREATE INDEX t2f ON t2(f);"
58 puts " CREATE INDEX t2g ON t2(g);"
59 puts " CREATE TABLE t3(a INTEGER PRIMARY KEY,b,c,d,e,f,g);"
60 puts " INSERT INTO t3 SELECT * FROM t2;"
61 puts " CREATE INDEX t3b ON t3(b,c);"
62 puts " CREATE INDEX t3c ON t3(c,e);"
63 puts " CREATE INDEX t3d ON t3(d,g);"
64 puts " CREATE INDEX t3e ON t3(e,f,g);"
65 puts " CREATE INDEX t3f ON t3(f,b,d,c);"
66 puts " CREATE INDEX t3g ON t3(g,f);"
72 set term
(1000000<b
) {}
74 set term
(c
>=[expr {int
(($NA+2)/3)*1001+1}]) {}
85 set termlist
[array names term
]
86 set nterm
[llength $termlist]
87 for {set i
2} {$i<=$NT+1} {incr i
} {
88 set n
[expr {int
(rand
()*10)+2}]
91 for {set j
0} {$j<$n} {incr j
} {
92 set k
[expr {int
(rand
()*$nterm)}]
93 set t
[lindex $termlist $k]
99 if {[info exists seen
($w)]} {
104 set result
[lsort -int [array names r
]]
105 puts "do_test where7-2.$i.1 \173"
106 puts " count_steps_sort \173"
107 puts " SELECT a FROM t2"
108 set wc
[join $w "\n OR "]
111 puts "\175 {$result scan 0 sort 0}"
112 puts "do_test where7-2.$i.2 \173"
113 puts " count_steps_sort \173"
114 puts " SELECT a FROM t3"
115 set wc
[join $w "\n OR "]
118 puts "\175 {$result scan 0 sort 0}"