CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
148 lines
3.9 KiB
Plaintext
148 lines
3.9 KiB
Plaintext
# 2008 Feb 19
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
# The focus of this file is testing the r-tree extension.
|
|
#
|
|
|
|
if {![info exists testdir]} {
|
|
set testdir [file join [file dirname [info script]] .. .. test]
|
|
}
|
|
source [file join [file dirname [info script]] rtree_util.tcl]
|
|
source $testdir/tester.tcl
|
|
|
|
ifcapable !rtree {
|
|
finish_test
|
|
return
|
|
}
|
|
|
|
set ::NROW 1000
|
|
set ::NDEL 10
|
|
set ::NSELECT 100
|
|
|
|
if {[info exists G(isquick)] && $G(isquick)} {
|
|
set ::NROW 100
|
|
set ::NSELECT 10
|
|
}
|
|
|
|
foreach module {rtree_i32 rtree} {
|
|
if {$module=="rtree_i32"} {set etype INT} {set etype REAL}
|
|
for {set nDim 1} {$nDim <= 5} {incr nDim} {
|
|
|
|
do_test rtree2-$module.$nDim.1 {
|
|
set cols [list]
|
|
foreach c [list c0 c1 c2 c3 c4 c5 c6 c7 c8 c9] {
|
|
lappend cols "$c $etype"
|
|
}
|
|
set cols [join [lrange $cols 0 [expr {$nDim*2-1}]] ", "]
|
|
execsql "
|
|
CREATE VIRTUAL TABLE t1 USING ${module}(ii, $cols);
|
|
CREATE TABLE t2 (ii, $cols);
|
|
"
|
|
} {}
|
|
|
|
do_test rtree2-$module.$nDim.2 {
|
|
db transaction {
|
|
for {set ii 0} {$ii < $::NROW} {incr ii} {
|
|
#puts "Row $ii"
|
|
set values [list]
|
|
for {set jj 0} {$jj<$nDim*2} {incr jj} {
|
|
lappend values [expr int(rand()*1000)]
|
|
}
|
|
set values [join $values ,]
|
|
#puts [rtree_treedump db t1]
|
|
#puts "INSERT INTO t2 VALUES($ii, $values)"
|
|
set rc [catch {db eval "INSERT INTO t1 VALUES($ii, $values)"}]
|
|
if {$rc} {
|
|
incr ii -1
|
|
} else {
|
|
db eval "INSERT INTO t2 VALUES($ii, $values)"
|
|
}
|
|
#if {[rtree_check db t1]} {
|
|
#puts [rtree_treedump db t1]
|
|
#exit
|
|
#}
|
|
}
|
|
}
|
|
|
|
set t1 [execsql {SELECT * FROM t1 ORDER BY ii}]
|
|
set t2 [execsql {SELECT * FROM t2 ORDER BY ii}]
|
|
set rc [expr {$t1 eq $t2}]
|
|
if {$rc != 1} {
|
|
puts $t1
|
|
puts $t2
|
|
}
|
|
set rc
|
|
} {1}
|
|
|
|
do_rtree_integrity_test rtree2-$module.$nDim.3 t1
|
|
|
|
set OPS [list < > <= >= =]
|
|
for {set ii 0} {$ii < $::NSELECT} {incr ii} {
|
|
do_test rtree2-$module.$nDim.4.$ii.1 {
|
|
set where [list]
|
|
foreach look_three_dots! {. . .} {
|
|
set colidx [expr int(rand()*($nDim*2+1))-1]
|
|
if {$colidx<0} {
|
|
set col ii
|
|
} else {
|
|
set col "c$colidx"
|
|
}
|
|
set op [lindex $OPS [expr int(rand()*[llength $OPS])]]
|
|
set val [expr int(rand()*1000)]
|
|
lappend where "$col $op $val"
|
|
}
|
|
set where [join $where " AND "]
|
|
|
|
set t1 [execsql "SELECT * FROM t1 WHERE $where ORDER BY ii"]
|
|
set t2 [execsql "SELECT * FROM t2 WHERE $where ORDER BY ii"]
|
|
set rc [expr {$t1 eq $t2}]
|
|
if {$rc != 1} {
|
|
#puts $where
|
|
puts $t1
|
|
puts $t2
|
|
#puts [rtree_treedump db t1]
|
|
#breakpoint
|
|
#set t1 [execsql "SELECT * FROM t1 WHERE $where ORDER BY ii"]
|
|
#exit
|
|
}
|
|
set rc
|
|
} {1}
|
|
}
|
|
|
|
for {set ii 0} {$ii < $::NROW} {incr ii $::NDEL} {
|
|
#puts [rtree_treedump db t1]
|
|
do_test rtree2-$module.$nDim.5.$ii.1 {
|
|
execsql "DELETE FROM t2 WHERE ii <= $::ii"
|
|
execsql "DELETE FROM t1 WHERE ii <= $::ii"
|
|
|
|
set t1 [execsql {SELECT * FROM t1 ORDER BY ii}]
|
|
set t2 [execsql {SELECT * FROM t2 ORDER BY ii}]
|
|
set rc [expr {$t1 eq $t2}]
|
|
if {$rc != 1} {
|
|
puts $t1
|
|
puts $t2
|
|
}
|
|
set rc
|
|
} {1}
|
|
do_rtree_integrity_test rtree2-$module.$nDim.5.$ii.2 t1
|
|
}
|
|
|
|
do_test rtree2-$module.$nDim.6 {
|
|
execsql {
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
}
|
|
} {}
|
|
}
|
|
}
|
|
|
|
finish_test
|