1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Add some rtree tests to the backcompat.test script.

FossilOrigin-Name: 8ea3601cd11088ae4d62bd4a05d1675301b26ace
This commit is contained in:
dan
2011-04-08 18:47:24 +00:00
parent e620c5e5ba
commit 1c152101ca
3 changed files with 80 additions and 7 deletions

View File

@ -369,4 +369,77 @@ do_allbackcompat_test {
}
}
#-------------------------------------------------------------------------
# Test that Rtree tables may be read/written by different versions of
# SQLite.
#
set contents {
CREATE VIRTUAL TABLE t1 USING rtree(id, x1, x2, y1, y2);
}
foreach {id x1 x2 y1 y2} {
1 -47.64 43.87 33.86 34.42 2 -21.51 17.32 2.05 31.04
3 -43.67 -38.33 -19.79 3.43 4 32.41 35.16 9.12 19.82
5 33.28 34.87 14.78 28.26 6 49.31 116.59 -9.87 75.09
7 -14.93 34.51 -17.64 64.09 8 -43.05 23.43 -1.19 69.44
9 44.79 133.56 28.09 80.30 10 -2.66 81.47 -41.38 -10.46
11 -42.89 -3.54 15.76 71.63 12 -3.50 84.96 -11.64 64.95
13 -45.69 26.25 11.14 55.06 14 -44.09 11.23 17.52 44.45
15 36.23 133.49 -19.38 53.67 16 -17.89 81.54 14.64 50.61
17 -41.97 -24.04 -39.43 28.95 18 -5.85 7.76 -6.38 47.02
19 18.82 27.10 42.82 100.09 20 39.17 113.45 26.14 73.47
21 22.31 103.17 49.92 106.05 22 -43.06 40.38 -1.75 76.08
23 2.43 57.27 -14.19 -3.83 24 -47.57 -4.35 8.93 100.06
25 -37.47 49.14 -29.11 8.81 26 -7.86 75.72 49.34 107.42
27 1.53 45.49 20.36 49.74 28 -48.48 32.54 28.81 54.45
29 2.67 39.77 -4.05 13.67 30 4.11 62.88 -47.44 -5.72
31 -21.47 51.75 37.25 116.09 32 45.59 111.37 -6.43 43.64
33 35.23 48.29 23.54 113.33 34 16.61 68.35 -14.69 65.97
35 13.98 16.60 48.66 102.87 36 19.74 23.84 31.15 77.27
37 -27.61 24.43 7.96 94.91 38 -34.77 12.05 -22.60 -6.29
39 -25.83 8.71 -13.48 -12.53 40 -17.11 -1.01 18.06 67.89
41 14.13 71.72 -3.78 39.25 42 23.75 76.00 -16.30 8.23
43 -39.15 28.63 38.12 125.88 44 48.62 86.09 36.49 102.95
45 -31.39 -21.98 2.52 89.78 46 5.65 56.04 15.94 89.10
47 18.28 95.81 46.46 143.08 48 30.93 102.82 -20.08 37.36
49 -20.78 -3.48 -5.58 35.46 50 49.85 90.58 -24.48 46.29
} {
if {$x1 >= $x2 || $y1 >= $y2} { error "$x1 $x2 $y1 $y2" }
append contents "INSERT INTO t1 VALUES($id, $x1, $x2, $y1, $y2);"
}
set queries {
1 "SELECT id FROM t1 WHERE x1>10 AND x2<44"
2 "SELECT id FROM t1 WHERE y1<100"
3 "SELECT id FROM t1 WHERE y1<100 AND x1>0"
4 "SELECT id FROM t1 WHERE y1>10 AND x1>0 AND x2<50 AND y2<550"
}
do_allbackcompat_test {
if {[code1 {set ::sqlite_options(fts3)}]
&& [code2 {set ::sqlite_options(fts3)}]
} {
do_test backcompat-4.1 { sql1 $contents } {}
foreach {n q} $::queries {
do_test backcompat-4.2.$n [list sql1 $q] [sql2 $q]
}
do_test backcompat-4.3 { sql1 {
INSERT INTO t1 SELECT id+100, x1+10.0, x2+10.0, y1-10.0, y2-10.0 FROM t1;
} } {}
foreach {n q} $::queries {
do_test backcompat-4.4.$n [list sql1 $q] [sql2 $q]
}
do_test backcompat-4.5 { sql2 {
INSERT INTO t1 SELECT id+200, x1+20.0, x2+20.0, y1-20.0, y2-20.0 FROM t1;
} } {}
foreach {n q} $::queries {
do_test backcompat-4.6.$n [list sql1 $q] [sql2 $q]
}
}
}
finish_test