Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/sqlite/src/ext/rtree/rtree4.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # 2008 May 23 1 # 2008 May 23
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
11 # 11 #
12 # Randomized test cases for the rtree extension. 12 # Randomized test cases for the rtree extension.
13 # 13 #
14 14
15 if {![info exists testdir]} { 15 if {![info exists testdir]} {
16 set testdir [file join [file dirname [info script]] .. .. test] 16 set testdir [file join [file dirname [info script]] .. .. test]
17 } 17 }
18 source $testdir/tester.tcl 18 source $testdir/tester.tcl
19 19
20 ifcapable !rtree { 20 ifcapable !rtree {
21 finish_test 21 finish_test
22 return 22 return
23 } 23 }
24 24
25 set ::NROW 2500 25 set ::NROW 2500
26 if {[info exists G(isquick)] && $G(isquick)} { 26 if {[info exists G(isquick)] && $G(isquick)} {
27 set ::NROW 250 27 set ::NROW 250
28 } 28 }
29 29
30 # Return a floating point number between -X and X. 30 ifcapable !rtree_int_only {
31 # 31 # Return a floating point number between -X and X.
32 proc rand {X} { 32 #
33 return [expr {int((rand()-0.5)*1024.0*$X)/512.0}] 33 proc rand {X} {
34 } 34 return [expr {int((rand()-0.5)*1024.0*$X)/512.0}]
35 35 }
36 # Return a positive floating point number less than or equal to X 36
37 # 37 # Return a positive floating point number less than or equal to X
38 proc randincr {X} { 38 #
39 while 1 { 39 proc randincr {X} {
40 set r [expr {int(rand()*$X*32.0)/32.0}] 40 while 1 {
41 if {$r>0.0} {return $r} 41 set r [expr {int(rand()*$X*32.0)/32.0}]
42 if {$r>0.0} {return $r}
43 }
44 }
45 } else {
46 # For rtree_int_only, return an number between -X and X.
47 #
48 proc rand {X} {
49 return [expr {int((rand()-0.5)*2*$X)}]
50 }
51
52 # Return a positive integer less than or equal to X
53 #
54 proc randincr {X} {
55 while 1 {
56 set r [expr {int(rand()*$X)+1}]
57 if {$r>0} {return $r}
58 }
42 } 59 }
43 } 60 }
44 61
45 # Scramble the $inlist into a random order. 62 # Scramble the $inlist into a random order.
46 # 63 #
47 proc scramble {inlist} { 64 proc scramble {inlist} {
48 set y {} 65 set y {}
49 foreach x $inlist { 66 foreach x $inlist {
50 lappend y [list [expr {rand()}] $x] 67 lappend y [list [expr {rand()}] $x]
51 } 68 }
52 set y [lsort $y] 69 set y [lsort $y]
53 set outlist {} 70 set outlist {}
54 foreach x $y { 71 foreach x $y {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 242 }
226 set where "WHERE [join [scramble $where] { AND }]" 243 set where "WHERE [join [scramble $where] { AND }]"
227 do_test rtree4-$nDim.2.$i.8 { 244 do_test rtree4-$nDim.2.$i.8 {
228 list $where [db eval "SELECT id FROM rx $where ORDER BY id"] 245 list $where [db eval "SELECT id FROM rx $where ORDER BY id"]
229 } [list $where [db eval "SELECT id FROM bx $where ORDER BY id"]] 246 } [list $where [db eval "SELECT id FROM bx $where ORDER BY id"]]
230 } 247 }
231 248
232 } 249 }
233 250
234 finish_test 251 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/ext/rtree/rtree1.test ('k') | third_party/sqlite/src/ext/rtree/rtree5.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698