65 lines
3.6 KiB
YAML
65 lines
3.6 KiB
YAML
desc: Test geo constructors
|
|
tests:
|
|
# Point
|
|
- cd: r.point(0, 0)
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[0, 0], 'type':'Point'})
|
|
- cd: r.point(0, -90)
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[0, -90], 'type':'Point'})
|
|
- cd: r.point(0, 90)
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[0, 90], 'type':'Point'})
|
|
- cd: r.point(-180, 0)
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[-180, 0], 'type':'Point'})
|
|
- cd: r.point(180, 0)
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[180, 0], 'type':'Point'})
|
|
- cd: r.point(0, -91)
|
|
ot: err('ReqlQueryLogicError', 'Latitude must be between -90 and 90. Got -91.', [0])
|
|
- cd: r.point(0, 91)
|
|
ot: err('ReqlQueryLogicError', 'Latitude must be between -90 and 90. Got 91.', [0])
|
|
- cd: r.point(-181, 0)
|
|
ot: err('ReqlQueryLogicError', 'Longitude must be between -180 and 180. Got -181.', [0])
|
|
- cd: r.point(181, 0)
|
|
ot: err('ReqlQueryLogicError', 'Longitude must be between -180 and 180. Got 181.', [0])
|
|
|
|
# Line
|
|
- cd: r.line()
|
|
ot: err('ReqlCompileError', 'Expected 2 or more arguments but found 0.', [0])
|
|
- cd: r.line([0,0])
|
|
ot: err('ReqlCompileError', 'Expected 2 or more arguments but found 1.', [0])
|
|
- cd: r.line([0,0], [0,0])
|
|
ot: err('ReqlQueryLogicError', 'Invalid LineString. Are there antipodal or duplicate vertices?', [0])
|
|
- cd: r.line([0,0], [0,1])
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[0,0], [0,1]], 'type':'LineString'})
|
|
- cd: r.line([0,0], [1])
|
|
ot: err('ReqlQueryLogicError', 'Expected point coordinate pair. Got 1 element array instead of a 2 element one.', [0])
|
|
- cd: r.line([0,0], [1,0,0])
|
|
ot: err('ReqlQueryLogicError', 'Expected point coordinate pair. Got 3 element array instead of a 2 element one.', [0])
|
|
- cd: r.line([0,0], [0,1], [0,0])
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[0,0], [0,1], [0,0]], 'type':'LineString'})
|
|
- cd: r.line(r.point(0,0), r.point(0,1), r.point(0,0))
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[0,0], [0,1], [0,0]], 'type':'LineString'})
|
|
- cd: r.line(r.point(0,0), r.point(1,0), r.line([0,0], [1,0]))
|
|
ot: err('ReqlQueryLogicError', 'Expected geometry of type `Point` but found `LineString`.', [0])
|
|
|
|
# Polygon
|
|
- cd: r.polygon()
|
|
ot: err('ReqlCompileError', 'Expected 3 or more arguments but found 0.', [0])
|
|
- cd: r.polygon([0,0])
|
|
ot: err('ReqlCompileError', 'Expected 3 or more arguments but found 1.', [0])
|
|
- cd: r.polygon([0,0], [0,0])
|
|
ot: err('ReqlCompileError', 'Expected 3 or more arguments but found 2.', [0])
|
|
- cd: r.polygon([0,0], [0,0], [0,0], [0,0])
|
|
ot: err('ReqlQueryLogicError', 'Invalid LinearRing. Are there antipodal or duplicate vertices? Is it self-intersecting?', [0])
|
|
- cd: r.polygon([0,0], [0,1], [1,0])
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0], [0,1], [1,0], [0,0]]], 'type':'Polygon'})
|
|
- cd: r.polygon([0,0], [0,1], [1,0], [0,0])
|
|
ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0], [0,1], [1,0], [0,0]]], 'type':'Polygon'})
|
|
- cd: r.polygon([0,0], [0,1], [1,0], [-1,0.5])
|
|
ot: err('ReqlQueryLogicError', 'Invalid LinearRing. Are there antipodal or duplicate vertices? Is it self-intersecting?', [0])
|
|
- cd: r.polygon([0,0], [0,1], [0])
|
|
ot: err('ReqlQueryLogicError', 'Expected point coordinate pair. Got 1 element array instead of a 2 element one.', [0])
|
|
- cd: r.polygon([0,0], [0,1], [0,1,0])
|
|
ot: err('ReqlQueryLogicError', 'Expected point coordinate pair. Got 3 element array instead of a 2 element one.', [0])
|
|
- cd: r.polygon(r.point(0,0), r.point(0,1), r.line([0,0], [0,1]))
|
|
ot: err('ReqlQueryLogicError', 'Expected geometry of type `Point` but found `LineString`.', [0])
|
|
|