gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/internal/integration/reql_tests/reql_geo_operations_test.go (about) 1 // Code generated by gen_tests.py and process_polyglot.py. 2 // Do not edit this file directly. 3 // The template for this file is located at: 4 // ../template.go.tpl 5 package reql_tests 6 7 import ( 8 "testing" 9 "time" 10 11 "github.com/stretchr/testify/suite" 12 r "gopkg.in/rethinkdb/rethinkdb-go.v6" 13 "gopkg.in/rethinkdb/rethinkdb-go.v6/internal/compare" 14 ) 15 16 // Test basic geometry operators 17 func TestGeoOperationsSuite(t *testing.T) { 18 suite.Run(t, new(GeoOperationsSuite)) 19 } 20 21 type GeoOperationsSuite struct { 22 suite.Suite 23 24 session *r.Session 25 } 26 27 func (suite *GeoOperationsSuite) SetupTest() { 28 suite.T().Log("Setting up GeoOperationsSuite") 29 // Use imports to prevent errors 30 _ = time.Time{} 31 _ = compare.AnythingIsFine 32 33 session, err := r.Connect(r.ConnectOpts{ 34 Address: url, 35 }) 36 suite.Require().NoError(err, "Error returned when connecting to server") 37 suite.session = session 38 39 r.DBDrop("test").Exec(suite.session) 40 err = r.DBCreate("test").Exec(suite.session) 41 suite.Require().NoError(err) 42 err = r.DB("test").Wait().Exec(suite.session) 43 suite.Require().NoError(err) 44 45 } 46 47 func (suite *GeoOperationsSuite) TearDownSuite() { 48 suite.T().Log("Tearing down GeoOperationsSuite") 49 50 if suite.session != nil { 51 r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session) 52 r.DBDrop("test").Exec(suite.session) 53 54 suite.session.Close() 55 } 56 } 57 58 func (suite *GeoOperationsSuite) TestCases() { 59 suite.T().Log("Running GeoOperationsSuite: Test basic geometry operators") 60 61 { 62 // geo/operations.yaml line #5 63 /* ("89011.26253835332") */ 64 var expected_ string = "89011.26253835332" 65 /* r.distance(r.point(-122, 37), r.point(-123, 37)).coerce_to('STRING') */ 66 67 suite.T().Log("About to run line #5: r.Distance(r.Point(-122, 37), r.Point(-123, 37)).CoerceTo('STRING')") 68 69 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(-122, 37), r.Point(-123, 37)).CoerceTo("STRING"), suite.session, r.RunOpts{ 70 GeometryFormat: "raw", 71 GroupFormat: "map", 72 }) 73 suite.T().Log("Finished running line #5") 74 } 75 76 { 77 // geo/operations.yaml line #7 78 /* ("110968.30443995494") */ 79 var expected_ string = "110968.30443995494" 80 /* r.distance(r.point(-122, 37), r.point(-122, 36)).coerce_to('STRING') */ 81 82 suite.T().Log("About to run line #7: r.Distance(r.Point(-122, 37), r.Point(-122, 36)).CoerceTo('STRING')") 83 84 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(-122, 37), r.Point(-122, 36)).CoerceTo("STRING"), suite.session, r.RunOpts{ 85 GeometryFormat: "raw", 86 GroupFormat: "map", 87 }) 88 suite.T().Log("Finished running line #7") 89 } 90 91 { 92 // geo/operations.yaml line #9 93 /* true */ 94 var expected_ bool = true 95 /* r.distance(r.point(-122, 37), r.point(-122, 36)).eq(r.distance(r.point(-122, 36), r.point(-122, 37))) */ 96 97 suite.T().Log("About to run line #9: r.Distance(r.Point(-122, 37), r.Point(-122, 36)).Eq(r.Distance(r.Point(-122, 36), r.Point(-122, 37)))") 98 99 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(-122, 37), r.Point(-122, 36)).Eq(r.Distance(r.Point(-122, 36), r.Point(-122, 37))), suite.session, r.RunOpts{ 100 GeometryFormat: "raw", 101 GroupFormat: "map", 102 }) 103 suite.T().Log("Finished running line #9") 104 } 105 106 { 107 // geo/operations.yaml line #11 108 /* ("89011.26253835332") */ 109 var expected_ string = "89011.26253835332" 110 /* r.point(-122, 37).distance(r.point(-123, 37)).coerce_to('STRING') */ 111 112 suite.T().Log("About to run line #11: r.Point(-122, 37).Distance(r.Point(-123, 37)).CoerceTo('STRING')") 113 114 runAndAssert(suite.Suite, expected_, r.Point(-122, 37).Distance(r.Point(-123, 37)).CoerceTo("STRING"), suite.session, r.RunOpts{ 115 GeometryFormat: "raw", 116 GroupFormat: "map", 117 }) 118 suite.T().Log("Finished running line #11") 119 } 120 121 // geo/operations.yaml line #13 122 // someDist = r.distance(r.point(-122, 37), r.point(-123, 37)) 123 suite.T().Log("Possibly executing: var someDist r.Term = r.Distance(r.Point(-122, 37), r.Point(-123, 37))") 124 125 someDist := r.Distance(r.Point(-122, 37), r.Point(-123, 37)) 126 _ = someDist // Prevent any noused variable errors 127 128 { 129 // geo/operations.yaml line #15 130 /* true */ 131 var expected_ bool = true 132 /* someDist.eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='m')) */ 133 134 suite.T().Log("About to run line #15: someDist.Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: 'm', }))") 135 136 runAndAssert(suite.Suite, expected_, someDist.Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: "m"})), suite.session, r.RunOpts{ 137 GeometryFormat: "raw", 138 GroupFormat: "map", 139 }) 140 suite.T().Log("Finished running line #15") 141 } 142 143 { 144 // geo/operations.yaml line #19 145 /* true */ 146 var expected_ bool = true 147 /* someDist.mul(1.0/1000.0).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='km')) */ 148 149 suite.T().Log("About to run line #19: someDist.Mul(r.Div(1.0, 1000.0)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: 'km', }))") 150 151 runAndAssert(suite.Suite, expected_, someDist.Mul(r.Div(1.0, 1000.0)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: "km"})), suite.session, r.RunOpts{ 152 GeometryFormat: "raw", 153 GroupFormat: "map", 154 }) 155 suite.T().Log("Finished running line #19") 156 } 157 158 { 159 // geo/operations.yaml line #23 160 /* true */ 161 var expected_ bool = true 162 /* someDist.mul(1.0/1609.344).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='mi')) */ 163 164 suite.T().Log("About to run line #23: someDist.Mul(r.Div(1.0, 1609.344)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: 'mi', }))") 165 166 runAndAssert(suite.Suite, expected_, someDist.Mul(r.Div(1.0, 1609.344)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: "mi"})), suite.session, r.RunOpts{ 167 GeometryFormat: "raw", 168 GroupFormat: "map", 169 }) 170 suite.T().Log("Finished running line #23") 171 } 172 173 { 174 // geo/operations.yaml line #27 175 /* true */ 176 var expected_ bool = true 177 /* someDist.mul(1.0/0.3048).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='ft')) */ 178 179 suite.T().Log("About to run line #27: someDist.Mul(r.Div(1.0, 0.3048)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: 'ft', }))") 180 181 runAndAssert(suite.Suite, expected_, someDist.Mul(r.Div(1.0, 0.3048)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: "ft"})), suite.session, r.RunOpts{ 182 GeometryFormat: "raw", 183 GroupFormat: "map", 184 }) 185 suite.T().Log("Finished running line #27") 186 } 187 188 { 189 // geo/operations.yaml line #31 190 /* true */ 191 var expected_ bool = true 192 /* someDist.mul(1.0/1852.0).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='nm')) */ 193 194 suite.T().Log("About to run line #31: someDist.Mul(r.Div(1.0, 1852.0)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: 'nm', }))") 195 196 runAndAssert(suite.Suite, expected_, someDist.Mul(r.Div(1.0, 1852.0)).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{Unit: "nm"})), suite.session, r.RunOpts{ 197 GeometryFormat: "raw", 198 GroupFormat: "map", 199 }) 200 suite.T().Log("Finished running line #31") 201 } 202 203 { 204 // geo/operations.yaml line #35 205 /* true */ 206 var expected_ bool = true 207 /* someDist.eq(r.distance(r.point(-122, 37), r.point(-123, 37), geo_system='WGS84')) */ 208 209 suite.T().Log("About to run line #35: someDist.Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{GeoSystem: 'WGS84', }))") 210 211 runAndAssert(suite.Suite, expected_, someDist.Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{GeoSystem: "WGS84"})), suite.session, r.RunOpts{ 212 GeometryFormat: "raw", 213 GroupFormat: "map", 214 }) 215 suite.T().Log("Finished running line #35") 216 } 217 218 { 219 // geo/operations.yaml line #40 220 /* true */ 221 var expected_ bool = true 222 /* someDist.div(10).eq(r.distance(r.point(-122, 37), r.point(-123, 37), geo_system={'a':637813.7, 'f':(1.0/298.257223563)})) */ 223 224 suite.T().Log("About to run line #40: someDist.Div(10).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{GeoSystem: map[interface{}]interface{}{'a': 637813.7, 'f': r.Div(1.0, 298.257223563), }, }))") 225 226 runAndAssert(suite.Suite, expected_, someDist.Div(10).Eq(r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{GeoSystem: map[interface{}]interface{}{"a": 637813.7, "f": r.Div(1.0, 298.257223563)}})), suite.session, r.RunOpts{ 227 GeometryFormat: "raw", 228 GroupFormat: "map", 229 }) 230 suite.T().Log("Finished running line #40") 231 } 232 233 { 234 // geo/operations.yaml line #43 235 /* ("0.01393875509649327") */ 236 var expected_ string = "0.01393875509649327" 237 /* r.distance(r.point(-122, 37), r.point(-123, 37), geo_system='unit_sphere').coerce_to('STRING') */ 238 239 suite.T().Log("About to run line #43: r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{GeoSystem: 'unit_sphere', }).CoerceTo('STRING')") 240 241 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(-122, 37), r.Point(-123, 37)).OptArgs(r.DistanceOpts{GeoSystem: "unit_sphere"}).CoerceTo("STRING"), suite.session, r.RunOpts{ 242 GeometryFormat: "raw", 243 GroupFormat: "map", 244 }) 245 suite.T().Log("Finished running line #43") 246 } 247 248 { 249 // geo/operations.yaml line #47 250 /* ("0") */ 251 var expected_ string = "0" 252 /* r.distance(r.point(0, 0), r.point(0, 0)).coerce_to('STRING') */ 253 254 suite.T().Log("About to run line #47: r.Distance(r.Point(0, 0), r.Point(0, 0)).CoerceTo('STRING')") 255 256 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Point(0, 0)).CoerceTo("STRING"), suite.session, r.RunOpts{ 257 GeometryFormat: "raw", 258 GroupFormat: "map", 259 }) 260 suite.T().Log("Finished running line #47") 261 } 262 263 { 264 // geo/operations.yaml line #50 265 /* ("40007862.917250897") */ 266 var expected_ string = "40007862.917250897" 267 /* r.distance(r.point(0, 0), r.point(180, 0)).mul(2).coerce_to('STRING') */ 268 269 suite.T().Log("About to run line #50: r.Distance(r.Point(0, 0), r.Point(180, 0)).Mul(2).CoerceTo('STRING')") 270 271 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Point(180, 0)).Mul(2).CoerceTo("STRING"), suite.session, r.RunOpts{ 272 GeometryFormat: "raw", 273 GroupFormat: "map", 274 }) 275 suite.T().Log("Finished running line #50") 276 } 277 278 { 279 // geo/operations.yaml line #52 280 /* ("40007862.917250897") */ 281 var expected_ string = "40007862.917250897" 282 /* r.distance(r.point(0, -90), r.point(0, 90)).mul(2).coerce_to('STRING') */ 283 284 suite.T().Log("About to run line #52: r.Distance(r.Point(0, -90), r.Point(0, 90)).Mul(2).CoerceTo('STRING')") 285 286 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, -90), r.Point(0, 90)).Mul(2).CoerceTo("STRING"), suite.session, r.RunOpts{ 287 GeometryFormat: "raw", 288 GroupFormat: "map", 289 }) 290 suite.T().Log("Finished running line #52") 291 } 292 293 { 294 // geo/operations.yaml line #54 295 /* ("0") */ 296 var expected_ string = "0" 297 /* r.distance(r.point(0, 0), r.line([0,0], [0,1])).coerce_to('STRING') */ 298 299 suite.T().Log("About to run line #54: r.Distance(r.Point(0, 0), r.Line([]interface{}{0, 0}, []interface{}{0, 1})).CoerceTo('STRING')") 300 301 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Line([]interface{}{0, 0}, []interface{}{0, 1})).CoerceTo("STRING"), suite.session, r.RunOpts{ 302 GeometryFormat: "raw", 303 GroupFormat: "map", 304 }) 305 suite.T().Log("Finished running line #54") 306 } 307 308 { 309 // geo/operations.yaml line #56 310 /* ("0") */ 311 var expected_ string = "0" 312 /* r.distance(r.line([0,0], [0,1]), r.point(0, 0)).coerce_to('STRING') */ 313 314 suite.T().Log("About to run line #56: r.Distance(r.Line([]interface{}{0, 0}, []interface{}{0, 1}), r.Point(0, 0)).CoerceTo('STRING')") 315 316 runAndAssert(suite.Suite, expected_, r.Distance(r.Line([]interface{}{0, 0}, []interface{}{0, 1}), r.Point(0, 0)).CoerceTo("STRING"), suite.session, r.RunOpts{ 317 GeometryFormat: "raw", 318 GroupFormat: "map", 319 }) 320 suite.T().Log("Finished running line #56") 321 } 322 323 { 324 // geo/operations.yaml line #58 325 /* true */ 326 var expected_ bool = true 327 /* r.distance(r.point(0, 0), r.line([0.1,0], [1,0])).eq(r.distance(r.point(0, 0), r.point(0.1, 0))) */ 328 329 suite.T().Log("About to run line #58: r.Distance(r.Point(0, 0), r.Line([]interface{}{0.1, 0}, []interface{}{1, 0})).Eq(r.Distance(r.Point(0, 0), r.Point(0.1, 0)))") 330 331 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Line([]interface{}{0.1, 0}, []interface{}{1, 0})).Eq(r.Distance(r.Point(0, 0), r.Point(0.1, 0))), suite.session, r.RunOpts{ 332 GeometryFormat: "raw", 333 GroupFormat: "map", 334 }) 335 suite.T().Log("Finished running line #58") 336 } 337 338 { 339 // geo/operations.yaml line #60 340 /* ("492471.4990055255") */ 341 var expected_ string = "492471.4990055255" 342 /* r.distance(r.point(0, 0), r.line([5,-1], [4,2])).coerce_to('STRING') */ 343 344 suite.T().Log("About to run line #60: r.Distance(r.Point(0, 0), r.Line([]interface{}{5, -1}, []interface{}{4, 2})).CoerceTo('STRING')") 345 346 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Line([]interface{}{5, -1}, []interface{}{4, 2})).CoerceTo("STRING"), suite.session, r.RunOpts{ 347 GeometryFormat: "raw", 348 GroupFormat: "map", 349 }) 350 suite.T().Log("Finished running line #60") 351 } 352 353 { 354 // geo/operations.yaml line #62 355 /* ("492471.4990055255") */ 356 var expected_ string = "492471.4990055255" 357 /* r.distance(r.point(0, 0), r.polygon([5,-1], [4,2], [10,10])).coerce_to('STRING') */ 358 359 suite.T().Log("About to run line #62: r.Distance(r.Point(0, 0), r.Polygon([]interface{}{5, -1}, []interface{}{4, 2}, []interface{}{10, 10})).CoerceTo('STRING')") 360 361 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Polygon([]interface{}{5, -1}, []interface{}{4, 2}, []interface{}{10, 10})).CoerceTo("STRING"), suite.session, r.RunOpts{ 362 GeometryFormat: "raw", 363 GroupFormat: "map", 364 }) 365 suite.T().Log("Finished running line #62") 366 } 367 368 { 369 // geo/operations.yaml line #64 370 /* ("0") */ 371 var expected_ string = "0" 372 /* r.distance(r.point(0, 0), r.polygon([0,-1], [0,1], [10,10])).coerce_to('STRING') */ 373 374 suite.T().Log("About to run line #64: r.Distance(r.Point(0, 0), r.Polygon([]interface{}{0, -1}, []interface{}{0, 1}, []interface{}{10, 10})).CoerceTo('STRING')") 375 376 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Polygon([]interface{}{0, -1}, []interface{}{0, 1}, []interface{}{10, 10})).CoerceTo("STRING"), suite.session, r.RunOpts{ 377 GeometryFormat: "raw", 378 GroupFormat: "map", 379 }) 380 suite.T().Log("Finished running line #64") 381 } 382 383 { 384 // geo/operations.yaml line #66 385 /* ("0") */ 386 var expected_ string = "0" 387 /* r.distance(r.point(0.5, 0.5), r.polygon([0,-1], [0,1], [10,10])).coerce_to('STRING') */ 388 389 suite.T().Log("About to run line #66: r.Distance(r.Point(0.5, 0.5), r.Polygon([]interface{}{0, -1}, []interface{}{0, 1}, []interface{}{10, 10})).CoerceTo('STRING')") 390 391 runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0.5, 0.5), r.Polygon([]interface{}{0, -1}, []interface{}{0, 1}, []interface{}{10, 10})).CoerceTo("STRING"), suite.session, r.RunOpts{ 392 GeometryFormat: "raw", 393 GroupFormat: "map", 394 }) 395 suite.T().Log("Finished running line #66") 396 } 397 398 { 399 // geo/operations.yaml line #71 400 /* false */ 401 var expected_ bool = false 402 /* r.circle([0,0], 1, fill=false).eq(r.circle([0,0], 1, fill=true)) */ 403 404 suite.T().Log("About to run line #71: r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: false, }).Eq(r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: true, }))") 405 406 runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: false}).Eq(r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: true})), suite.session, r.RunOpts{ 407 GeometryFormat: "raw", 408 GroupFormat: "map", 409 }) 410 suite.T().Log("Finished running line #71") 411 } 412 413 { 414 // geo/operations.yaml line #75 415 /* true */ 416 var expected_ bool = true 417 /* r.circle([0,0], 1, fill=false).fill().eq(r.circle([0,0], 1, fill=true)) */ 418 419 suite.T().Log("About to run line #75: r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: false, }).Fill().Eq(r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: true, }))") 420 421 runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: false}).Fill().Eq(r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{Fill: true})), suite.session, r.RunOpts{ 422 GeometryFormat: "raw", 423 GroupFormat: "map", 424 }) 425 suite.T().Log("Finished running line #75") 426 } 427 428 { 429 // geo/operations.yaml line #80 430 /* ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0],[1,0],[1,1],[0,1],[0,0]],[[0.1,0.1],[0.9,0.1],[0.9,0.9],[0.1,0.9],[0.1,0.1]]], 'type':'Polygon'}) */ 431 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}, []interface{}{0, 0}}, []interface{}{[]interface{}{0.1, 0.1}, []interface{}{0.9, 0.1}, []interface{}{0.9, 0.9}, []interface{}{0.1, 0.9}, []interface{}{0.1, 0.1}}}, "type": "Polygon"} 432 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0.1,0.1], [0.9,0.1], [0.9,0.9], [0.1,0.9])) */ 433 434 suite.T().Log("About to run line #80: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0.1, 0.1}, []interface{}{0.9, 0.1}, []interface{}{0.9, 0.9}, []interface{}{0.1, 0.9}))") 435 436 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0.1, 0.1}, []interface{}{0.9, 0.1}, []interface{}{0.9, 0.9}, []interface{}{0.1, 0.9})), suite.session, r.RunOpts{ 437 GeometryFormat: "raw", 438 GroupFormat: "map", 439 }) 440 suite.T().Log("Finished running line #80") 441 } 442 443 { 444 // geo/operations.yaml line #82 445 /* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */ 446 var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.") 447 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0.1,0.9], [0.9,0.0], [0.9,0.9], [0.1,0.9])) */ 448 449 suite.T().Log("About to run line #82: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0.1, 0.9}, []interface{}{0.9, 0.0}, []interface{}{0.9, 0.9}, []interface{}{0.1, 0.9}))") 450 451 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0.1, 0.9}, []interface{}{0.9, 0.0}, []interface{}{0.9, 0.9}, []interface{}{0.1, 0.9})), suite.session, r.RunOpts{ 452 GeometryFormat: "raw", 453 GroupFormat: "map", 454 }) 455 suite.T().Log("Finished running line #82") 456 } 457 458 { 459 // geo/operations.yaml line #84 460 /* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */ 461 var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.") 462 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,0], [2,0], [2,2], [0,2])) */ 463 464 suite.T().Log("About to run line #84: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, 0}, []interface{}{2, 0}, []interface{}{2, 2}, []interface{}{0, 2}))") 465 466 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, 0}, []interface{}{2, 0}, []interface{}{2, 2}, []interface{}{0, 2})), suite.session, r.RunOpts{ 467 GeometryFormat: "raw", 468 GroupFormat: "map", 469 }) 470 suite.T().Log("Finished running line #84") 471 } 472 473 { 474 // geo/operations.yaml line #86 475 /* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */ 476 var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.") 477 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,-2], [1,-2], [-1,1], [0,-1])) */ 478 479 suite.T().Log("About to run line #86: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, -2}, []interface{}{1, -2}, []interface{}{-1, 1}, []interface{}{0, -1}))") 480 481 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, -2}, []interface{}{1, -2}, []interface{}{-1, 1}, []interface{}{0, -1})), suite.session, r.RunOpts{ 482 GeometryFormat: "raw", 483 GroupFormat: "map", 484 }) 485 suite.T().Log("Finished running line #86") 486 } 487 488 { 489 // geo/operations.yaml line #88 490 /* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */ 491 var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.") 492 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,-1], [1,-1], [1,0], [0,0])) */ 493 494 suite.T().Log("About to run line #88: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, -1}, []interface{}{1, -1}, []interface{}{1, 0}, []interface{}{0, 0}))") 495 496 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, -1}, []interface{}{1, -1}, []interface{}{1, 0}, []interface{}{0, 0})), suite.session, r.RunOpts{ 497 GeometryFormat: "raw", 498 GroupFormat: "map", 499 }) 500 suite.T().Log("Finished running line #88") 501 } 502 503 { 504 // geo/operations.yaml line #90 505 /* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */ 506 var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.") 507 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0.1,-1], [0.9,-1], [0.9,0.5], [0.1,0.5])) */ 508 509 suite.T().Log("About to run line #90: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0.1, -1}, []interface{}{0.9, -1}, []interface{}{0.9, 0.5}, []interface{}{0.1, 0.5}))") 510 511 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0.1, -1}, []interface{}{0.9, -1}, []interface{}{0.9, 0.5}, []interface{}{0.1, 0.5})), suite.session, r.RunOpts{ 512 GeometryFormat: "raw", 513 GroupFormat: "map", 514 }) 515 suite.T().Log("Finished running line #90") 516 } 517 518 { 519 // geo/operations.yaml line #92 520 /* ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0],[1,0],[1,1],[0,1],[0,0]],[[0,0],[0.1,0.9],[0.9,0.9],[0.9,0.1],[0,0]]], 'type':'Polygon'}) */ 521 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}, []interface{}{0, 0}}, []interface{}{[]interface{}{0, 0}, []interface{}{0.1, 0.9}, []interface{}{0.9, 0.9}, []interface{}{0.9, 0.1}, []interface{}{0, 0}}}, "type": "Polygon"} 522 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,0],[0.1,0.9],[0.9,0.9],[0.9,0.1])) */ 523 524 suite.T().Log("About to run line #92: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, 0}, []interface{}{0.1, 0.9}, []interface{}{0.9, 0.9}, []interface{}{0.9, 0.1}))") 525 526 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, 0}, []interface{}{0.1, 0.9}, []interface{}{0.9, 0.9}, []interface{}{0.9, 0.1})), suite.session, r.RunOpts{ 527 GeometryFormat: "raw", 528 GroupFormat: "map", 529 }) 530 suite.T().Log("Finished running line #92") 531 } 532 533 { 534 // geo/operations.yaml line #94 535 /* err('ReqlQueryLogicError', 'Expected a Polygon with only an outer shell. This one has holes.', [0]) */ 536 var expected_ Err = err("ReqlQueryLogicError", "Expected a Polygon with only an outer shell. This one has holes.") 537 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,0],[0.1,0.9],[0.9,0.9],[0.9,0.1]).polygon_sub(r.polygon([0.2,0.2],[0.5,0.8],[0.8,0.2]))) */ 538 539 suite.T().Log("About to run line #94: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, 0}, []interface{}{0.1, 0.9}, []interface{}{0.9, 0.9}, []interface{}{0.9, 0.1}).PolygonSub(r.Polygon([]interface{}{0.2, 0.2}, []interface{}{0.5, 0.8}, []interface{}{0.8, 0.2})))") 540 541 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Polygon([]interface{}{0, 0}, []interface{}{0.1, 0.9}, []interface{}{0.9, 0.9}, []interface{}{0.9, 0.1}).PolygonSub(r.Polygon([]interface{}{0.2, 0.2}, []interface{}{0.5, 0.8}, []interface{}{0.8, 0.2}))), suite.session, r.RunOpts{ 542 GeometryFormat: "raw", 543 GroupFormat: "map", 544 }) 545 suite.T().Log("Finished running line #94") 546 } 547 548 { 549 // geo/operations.yaml line #96 550 /* err('ReqlQueryLogicError', 'Expected a Polygon but found a LineString.', []) */ 551 var expected_ Err = err("ReqlQueryLogicError", "Expected a Polygon but found a LineString.") 552 /* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.line([0,0],[0.9,0.1],[0.9,0.9],[0.1,0.9])) */ 553 554 suite.T().Log("About to run line #96: r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Line([]interface{}{0, 0}, []interface{}{0.9, 0.1}, []interface{}{0.9, 0.9}, []interface{}{0.1, 0.9}))") 555 556 runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{0, 0}, []interface{}{1, 0}, []interface{}{1, 1}, []interface{}{0, 1}).PolygonSub(r.Line([]interface{}{0, 0}, []interface{}{0.9, 0.1}, []interface{}{0.9, 0.9}, []interface{}{0.1, 0.9})), suite.session, r.RunOpts{ 557 GeometryFormat: "raw", 558 GroupFormat: "map", 559 }) 560 suite.T().Log("Finished running line #96") 561 } 562 }