|
| 1 | +/* |
| 2 | +This set of tests is designed to verify the compliance of the contain operation with the DE-9IM model |
| 3 | +*/ |
| 4 | +-- sline vs spoint |
| 5 | +-- the point lies far beyond the line |
| 6 | +select 'sline ~ spoint', 'f' as expected, sline(spoint'(270d,10d)', spoint'(270d,30d)') ~ spoint'(0d, 50d)' as actual; |
| 7 | + ?column? | expected | actual |
| 8 | +----------------+----------+-------- |
| 9 | + sline ~ spoint | f | f |
| 10 | +(1 row) |
| 11 | + |
| 12 | +-- the point lies in the boundary of line |
| 13 | +select 'sline ~ spoint', 'f' as expected, sline(spoint'(270d,10d)', spoint'(270d,30d)') ~ spoint'(270d, 10d)' as actual; |
| 14 | + ?column? | expected | actual |
| 15 | +----------------+----------+-------- |
| 16 | + sline ~ spoint | f | t |
| 17 | +(1 row) |
| 18 | + |
| 19 | +-- the point lies in the interior of line |
| 20 | +select 'sline ~ spoint', 't' as expected, sline(spoint'(270d,10d)', spoint'(270d,30d)') ~ spoint'(270d, 20d)' as actual; |
| 21 | + ?column? | expected | actual |
| 22 | +----------------+----------+-------- |
| 23 | + sline ~ spoint | t | t |
| 24 | +(1 row) |
| 25 | + |
| 26 | +-- the point and line that degenerated into the point coincide |
| 27 | +select 'sline ~ spoint', 't' as expected, sline(spoint'(270d,10d)', spoint'(270d,10d)') ~ spoint'(270d, 10d)' as actual; |
| 28 | + ?column? | expected | actual |
| 29 | +----------------+----------+-------- |
| 30 | + sline ~ spoint | t | t |
| 31 | +(1 row) |
| 32 | + |
| 33 | +-- the point and line that degenerated into the point do not coincide |
| 34 | +select 'sline ~ spoint', 'f' as expected, sline(spoint'(270d,10d)', spoint'(270d,10d)') ~ spoint'(270d, 20d)' as actual; |
| 35 | + ?column? | expected | actual |
| 36 | +----------------+----------+-------- |
| 37 | + sline ~ spoint | f | f |
| 38 | +(1 row) |
| 39 | + |
| 40 | +-- spoint vs scircle |
| 41 | +-- the point lies far beyond the circle |
| 42 | +select 'spoint @ scircle', 'f' as expected, spoint'(0d,0d)' @ scircle'<(0d,90d),50d>' as actual; |
| 43 | + ?column? | expected | actual |
| 44 | +------------------+----------+-------- |
| 45 | + spoint @ scircle | f | f |
| 46 | +(1 row) |
| 47 | + |
| 48 | +-- the point lies in the boundary of circle |
| 49 | +select 'spoint @ scircle', 'f' as expected, spoint'(0d,80d)' @ scircle'<(0d,90d),10d>' as actual; |
| 50 | + ?column? | expected | actual |
| 51 | +------------------+----------+-------- |
| 52 | + spoint @ scircle | f | t |
| 53 | +(1 row) |
| 54 | + |
| 55 | +-- the point lies in the interior of circle |
| 56 | +select 'spoint @ scircle', 't' as expected, spoint'(0d,80d)' @ scircle'<(0d,90d),50d>' as actual; |
| 57 | + ?column? | expected | actual |
| 58 | +------------------+----------+-------- |
| 59 | + spoint @ scircle | t | t |
| 60 | +(1 row) |
| 61 | + |
| 62 | +-- the point and circle that degenerated into the point coincide |
| 63 | +select 'spoint @ scircle', 't' as expected, spoint'(0d,90d)' @ scircle'<(0d,90d),0d>' as actual; |
| 64 | + ?column? | expected | actual |
| 65 | +------------------+----------+-------- |
| 66 | + spoint @ scircle | t | t |
| 67 | +(1 row) |
| 68 | + |
| 69 | +-- the point and circle that degenerated into the point do not coincide |
| 70 | +select 'spoint @ scircle', 'f' as expected, spoint'(0d,50d)' @ scircle'<(0d,90d),0d>' as actual; |
| 71 | + ?column? | expected | actual |
| 72 | +------------------+----------+-------- |
| 73 | + spoint @ scircle | f | f |
| 74 | +(1 row) |
| 75 | + |
| 76 | +-- sellipse vs spoint |
| 77 | +-- the point lies far beyond the ellipse |
| 78 | +select 'sellipse ~ spoint', 'f' as expected, sellipse'<{ 30d , 20d }, (0d , 90d) , 0d>' ~ spoint'(0d, 0d)' as actual; |
| 79 | + ?column? | expected | actual |
| 80 | +-------------------+----------+-------- |
| 81 | + sellipse ~ spoint | f | f |
| 82 | +(1 row) |
| 83 | + |
| 84 | +-- the point lies in the boundary of ellipse |
| 85 | +select 'sellipse ~ spoint', 'f' as expected, sellipse'<{ 30d , 20d }, (0d , 90d) , 0d>' ~ spoint'(0d, 70d)' as actual; |
| 86 | + ?column? | expected | actual |
| 87 | +-------------------+----------+-------- |
| 88 | + sellipse ~ spoint | f | t |
| 89 | +(1 row) |
| 90 | + |
| 91 | +-- the point lies in the interior of ellipse |
| 92 | +select 'sellipse ~ spoint', 't' as expected, sellipse'<{ 30d , 20d }, (0d , 90d) , 0d>' ~ spoint'(90d, 65d)' as actual; |
| 93 | + ?column? | expected | actual |
| 94 | +-------------------+----------+-------- |
| 95 | + sellipse ~ spoint | t | t |
| 96 | +(1 row) |
| 97 | + |
| 98 | +-- the point lies in the boundary of ellipse that degenerated into the line |
| 99 | +select 'sellipse ~ spoint', 't' as expected, sellipse'<{ 10d , 0d }, (0d , 0d) , 0d>' ~ spoint'(10d, 0d)' as actual; |
| 100 | + ?column? | expected | actual |
| 101 | +-------------------+----------+-------- |
| 102 | + sellipse ~ spoint | t | t |
| 103 | +(1 row) |
| 104 | + |
| 105 | +-- the point lies in the interior of ellipse that degenerated into the line |
| 106 | +select 'sellipse ~ spoint', 't' as expected, sellipse'<{ 10d , 0d }, (0d , 0d) , 0d>' ~ spoint'(0d, 0d)' as actual; |
| 107 | + ?column? | expected | actual |
| 108 | +-------------------+----------+-------- |
| 109 | + sellipse ~ spoint | t | t |
| 110 | +(1 row) |
| 111 | + |
| 112 | +-- the point and ellipse that degenerated into the point coincide |
| 113 | +select 'sellipse ~ spoint', 't' as expected, sellipse'<{ 0d , 0d }, (0d , 90d) , 0d>' ~ spoint'(0d, 90d)' as actual; |
| 114 | + ?column? | expected | actual |
| 115 | +-------------------+----------+-------- |
| 116 | + sellipse ~ spoint | t | t |
| 117 | +(1 row) |
| 118 | + |
| 119 | +-- the point and ellipse that degenerated into the point do not coincide |
| 120 | +select 'sellipse ~ spoint', 'f' as expected, sellipse'<{ 0d , 0d }, (0d , 90d) , 0d>' ~ spoint'(0d, 91d)' as actual; |
| 121 | + ?column? | expected | actual |
| 122 | +-------------------+----------+-------- |
| 123 | + sellipse ~ spoint | f | f |
| 124 | +(1 row) |
| 125 | + |
| 126 | +-- spath vs spoint |
| 127 | +-- the point lies far beyond the opened path |
| 128 | +select 'spath ~ spoint', 'f' as expected, spath'{ (-10d, 0d),(10d,0d),(45d,15d),(80d,30d) }' ~ spoint'(0d, 90d)' as actual; |
| 129 | + ?column? | expected | actual |
| 130 | +----------------+----------+-------- |
| 131 | + spath ~ spoint | f | f |
| 132 | +(1 row) |
| 133 | + |
| 134 | +-- the point lies in the boundary of opened path |
| 135 | +select 'spath ~ spoint', 'f' as expected, spath'{ (-10d, 0d),(10d,0d),(45d,15d),(80d,30d) }' ~ spoint'(-10d, 0d)' as actual; |
| 136 | + ?column? | expected | actual |
| 137 | +----------------+----------+-------- |
| 138 | + spath ~ spoint | f | t |
| 139 | +(1 row) |
| 140 | + |
| 141 | +-- the point lies in the boundary of unsimple opened path |
| 142 | +select 'spath ~ spoint', 'f' as expected, spath'{ (-10d, 0d),(10d,0d),(45d,15d),(80d,30d),(-5d, 0d) }' ~ spoint'(-5d, 0d)' as actual; |
| 143 | + ?column? | expected | actual |
| 144 | +----------------+----------+-------- |
| 145 | + spath ~ spoint | f | t |
| 146 | +(1 row) |
| 147 | + |
| 148 | +-- the point lies in the interior of opened path |
| 149 | +select 'spath ~ spoint', 't' as expected, spath'{ (-10d, 0d),(10d,0d),(45d,15d),(80d,30d) }' ~ spoint'(9d, 0d)' as actual; |
| 150 | + ?column? | expected | actual |
| 151 | +----------------+----------+-------- |
| 152 | + spath ~ spoint | t | t |
| 153 | +(1 row) |
| 154 | + |
| 155 | +-- the point lies in the interior of closed path |
| 156 | +select 'spath ~ spoint', 't' as expected, spath'{ (-10d, 0d),(10d,0d),(45d,15d),(80d,30d),(-10d, 0d) }' ~ spoint'(-10d, 0d)' as actual; |
| 157 | + ?column? | expected | actual |
| 158 | +----------------+----------+-------- |
| 159 | + spath ~ spoint | t | t |
| 160 | +(1 row) |
| 161 | + |
| 162 | +-- spoly vs spoint |
| 163 | +-- the point lies far beyond the polygon |
| 164 | +select 'spoly ~ spoint', 'f' as expected, spoly'{ (0d,0d), (10d,0d), (20d,20d) }' ~ spoint'(0d, 90d)' as actual; |
| 165 | + ?column? | expected | actual |
| 166 | +----------------+----------+-------- |
| 167 | + spoly ~ spoint | f | f |
| 168 | +(1 row) |
| 169 | + |
| 170 | +-- the point lies in the boundary of polygon |
| 171 | +select 'spoly ~ spoint', 'f' as expected, spoly'{ (0d,0d), (10d,0d), (20d,20d) }' ~ spoint'(5d, 0d)' as actual; |
| 172 | + ?column? | expected | actual |
| 173 | +----------------+----------+-------- |
| 174 | + spoly ~ spoint | f | t |
| 175 | +(1 row) |
| 176 | + |
| 177 | +-- the point lies in the boundary of polygon |
| 178 | +select 'spoly ~ spoint', 'f' as expected, spoly'{ (0d,0d), (10d,0d), (20d,20d) }' ~ spoint'(20d, 20d)' as actual; |
| 179 | + ?column? | expected | actual |
| 180 | +----------------+----------+-------- |
| 181 | + spoly ~ spoint | f | t |
| 182 | +(1 row) |
| 183 | + |
| 184 | +-- the point lies in the interior of polygon |
| 185 | +select 'spoly ~ spoint', 't' as expected, spoly'{ (0d,0d), (10d,0d), (20d,20d) }' ~ spoint'(5d, 5d)' as actual; |
| 186 | + ?column? | expected | actual |
| 187 | +----------------+----------+-------- |
| 188 | + spoly ~ spoint | t | t |
| 189 | +(1 row) |
| 190 | + |
| 191 | +-- sbox vs spoint |
| 192 | +-- the point lies far beyond the box |
| 193 | +select 'sbox ~ spoint', 'f' as expected, sbox'( (0d,0d), (20d,10d) )' ~ spoint'(0d, 90d)' as actual; |
| 194 | + ?column? | expected | actual |
| 195 | +---------------+----------+-------- |
| 196 | + sbox ~ spoint | f | f |
| 197 | +(1 row) |
| 198 | + |
| 199 | +-- the point lies in the boundary of box |
| 200 | +select 'sbox ~ spoint', 'f' as expected, sbox'( (0d,0d), (20d,10d) )' ~ spoint'(0d, 5d)' as actual; |
| 201 | + ?column? | expected | actual |
| 202 | +---------------+----------+-------- |
| 203 | + sbox ~ spoint | f | t |
| 204 | +(1 row) |
| 205 | + |
| 206 | +-- the point lies in the boundary of box |
| 207 | +select 'sbox ~ spoint', 'f' as expected, sbox'( (0d,0d), (20d,10d) )' ~ spoint'(0d, 0d)' as actual; |
| 208 | + ?column? | expected | actual |
| 209 | +---------------+----------+-------- |
| 210 | + sbox ~ spoint | f | t |
| 211 | +(1 row) |
| 212 | + |
| 213 | +-- the point lies in the interior of box |
| 214 | +select 'sbox ~ spoint', 't' as expected, sbox'( (0d,0d), (20d,10d) )' ~ spoint'(5d, 5d)' as actual; |
| 215 | + ?column? | expected | actual |
| 216 | +---------------+----------+-------- |
| 217 | + sbox ~ spoint | t | t |
| 218 | +(1 row) |
| 219 | + |
| 220 | +-- the point and box that degenerated into the point coincide |
| 221 | +select 'sbox ~ spoint', 't' as expected, sbox'( (0d,0d), (0d,0d) )' ~ spoint'(0d, 0d)' as actual; |
| 222 | + ?column? | expected | actual |
| 223 | +---------------+----------+-------- |
| 224 | + sbox ~ spoint | t | t |
| 225 | +(1 row) |
| 226 | + |
| 227 | +-- the point and box that degenerated into the point do not coincide |
| 228 | +select 'sbox ~ spoint', 'f' as expected, sbox'( (0d,0d), (0d,0d) )' ~ spoint'(0d, 1d)' as actual; |
| 229 | + ?column? | expected | actual |
| 230 | +---------------+----------+-------- |
| 231 | + sbox ~ spoint | f | f |
| 232 | +(1 row) |
| 233 | + |
0 commit comments