summaryrefslogtreecommitdiff
path: root/ext/librethinkdbxx/test/upstream/geo/primitives.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'ext/librethinkdbxx/test/upstream/geo/primitives.yaml')
-rw-r--r--ext/librethinkdbxx/test/upstream/geo/primitives.yaml50
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/librethinkdbxx/test/upstream/geo/primitives.yaml b/ext/librethinkdbxx/test/upstream/geo/primitives.yaml
new file mode 100644
index 00000000..1fd2c0e0
--- /dev/null
+++ b/ext/librethinkdbxx/test/upstream/geo/primitives.yaml
@@ -0,0 +1,50 @@
+desc: Test geometric primitive constructors
+tests:
+ # Circle
+ - js: r.circle([0,0], 1, {num_vertices:3})
+ py: r.circle([0,0], 1, num_vertices=3)
+ rb: r.circle([0,0], 1, :num_vertices=>3)
+ ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0, -9.04369477050382e-06], [-7.779638566553426e-06, 4.5218473852518965e-06], [7.779638566553426e-06, 4.5218473852518965e-06], [0, -9.04369477050382e-06]]], 'type':'Polygon'})
+
+ - js: r.circle(r.point(0,0), 1, {num_vertices:3})
+ py: r.circle(r.point(0,0), 1, num_vertices=3)
+ rb: r.circle(r.point(0,0), 1, :num_vertices=>3)
+ ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0, -9.04369477050382e-06], [-7.779638566553426e-06, 4.5218473852518965e-06], [7.779638566553426e-06, 4.5218473852518965e-06], [0, -9.04369477050382e-06]]], 'type':'Polygon'})
+
+ - js: r.circle([0,0], 1, {num_vertices:3, fill:false})
+ py: r.circle([0,0], 1, num_vertices=3, fill=false)
+ rb: r.circle([0,0], 1, :num_vertices=>3, :fill=>false)
+ ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[0, -9.04369477050382e-06], [-7.779638566553426e-06, 4.5218473852518965e-06], [7.779638566553426e-06, 4.5218473852518965e-06], [0, -9.04369477050382e-06]], 'type':'LineString'})
+
+ - js: r.circle([0,0], 14000000, {num_vertices:3})
+ py: r.circle([0,0], 14000000, num_vertices=3)
+ rb: r.circle([0,0], 14000000, :num_vertices=>3)
+ ot: err('ReqlQueryLogicError', 'Radius must be smaller than a quarter of the circumference along the minor axis of the reference ellipsoid. Got 14000000m, but must be smaller than 9985163.1855612862855m.', [0])
+
+ - js: r.circle([0,0], 1, {num_vertices:3, geo_system:'WGS84'})
+ py: r.circle([0,0], 1, num_vertices=3, geo_system='WGS84')
+ rb: r.circle([0,0], 1, :num_vertices=>3, :geo_system=>'WGS84')
+ ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0, -9.04369477050382e-06], [-7.779638566553426e-06, 4.5218473852518965e-06], [7.779638566553426e-06, 4.5218473852518965e-06], [0, -9.04369477050382e-06]]], 'type':'Polygon'})
+
+ - js: r.circle([0,0], 2, {num_vertices:3, geo_system:'unit_'+'sphere'})
+ py: r.circle([0,0], 2, num_vertices=3, geo_system='unit_sphere')
+ rb: r.circle([0,0], 2, :num_vertices=>3, :geo_system=>'unit_sphere')
+ ot: err('ReqlQueryLogicError', 'Radius must be smaller than a quarter of the circumference along the minor axis of the reference ellipsoid. Got 2m, but must be smaller than 1.570796326794896558m.', [0])
+
+ - js: r.circle([0,0], 0.1, {num_vertices:3, geo_system:'unit_'+'sphere'})
+ py: r.circle([0,0], 0.1, num_vertices=3, geo_system='unit_sphere')
+ rb: r.circle([0,0], 0.1, :num_vertices=>3, :geo_system=>'unit_sphere')
+ ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0, -5.729577951308232], [-4.966092947444857, 2.861205754495701], [4.966092947444857, 2.861205754495701], [0, -5.729577951308232]]], 'type':'Polygon'})
+ testopts:
+ precision: 0.0000000000001
+
+ - js: r.circle([0,0], 1.0/1000.0, {num_vertices:3, unit:'km'})
+ py: r.circle([0,0], 1.0/1000.0, num_vertices=3, unit='km')
+ rb: r.circle([0,0], 1.0/1000.0, :num_vertices=>3, :unit=>'km')
+ ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0, -9.04369477050382e-06], [-7.779638566553426e-06, 4.5218473852518965e-06], [7.779638566553426e-06, 4.5218473852518965e-06], [0, -9.04369477050382e-06]]], 'type':'Polygon'})
+
+ - js: r.circle([0,0], 1.0/1609.344, {num_vertices:3, unit:'mi'})
+ py: r.circle([0,0], 1.0/1609.344, num_vertices=3, unit='mi')
+ rb: r.circle([0,0], 1.0/1609.344, :num_vertices=>3, :unit=>'mi')
+ ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0, -9.04369477050382e-06], [-7.779638566553426e-06, 4.5218473852518965e-06], [7.779638566553426e-06, 4.5218473852518965e-06], [0, -9.04369477050382e-06]]], 'type':'Polygon'})
+