コード例 #1
0
func (suite *MathLogicDivSuite) TestCases() {
	suite.T().Log("Running MathLogicDivSuite: Tests for the basic usage of the division operation")

	{
		// math_logic/div.yaml line #6
		/* 2 */
		var expected_ int = 2
		/* r.expr(4) / 2 */

		suite.T().Log("About to run line #6: r.Expr(4).Div(2)")

		runAndAssert(suite.Suite, expected_, r.Expr(4).Div(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// math_logic/div.yaml line #7
		/* 2 */
		var expected_ int = 2
		/* 4 / r.expr(2) */

		suite.T().Log("About to run line #7: r.Div(4, r.Expr(2))")

		runAndAssert(suite.Suite, expected_, r.Div(4, r.Expr(2)), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	{
		// math_logic/div.yaml line #8
		/* 2 */
		var expected_ int = 2
		/* r.expr(4).div(2) */

		suite.T().Log("About to run line #8: r.Expr(4).Div(2)")

		runAndAssert(suite.Suite, expected_, r.Expr(4).Div(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #8")
	}

	{
		// math_logic/div.yaml line #15
		/* 0.5 */
		var expected_ float64 = 0.5
		/* r.expr(-1) / -2 */

		suite.T().Log("About to run line #15: r.Expr(-1).Div(-2)")

		runAndAssert(suite.Suite, expected_, r.Expr(-1).Div(-2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #15")
	}

	{
		// math_logic/div.yaml line #20
		/* 4.9 / 0.7 */
		var expected_ float64 = 4.9 / 0.7
		/* r.expr(4.9) / 0.7 */

		suite.T().Log("About to run line #20: r.Expr(4.9).Div(0.7)")

		runAndAssert(suite.Suite, expected_, r.Expr(4.9).Div(0.7), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #20")
	}

	{
		// math_logic/div.yaml line #25
		/* 1.0/120 */
		var expected_ float64 = 1.0 / 120
		/* r.expr(1).div(2,3,4,5) */

		suite.T().Log("About to run line #25: r.Expr(1).Div(2, 3, 4, 5)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Div(2, 3, 4, 5), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #25")
	}

	{
		// math_logic/div.yaml line #37
		/* err('ReqlQueryLogicError', 'Cannot divide by zero.', [1]) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot divide by zero.")
		/* r.expr(1) / 0 */

		suite.T().Log("About to run line #37: r.Expr(1).Div(0)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Div(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	{
		// math_logic/div.yaml line #38
		/* err('ReqlQueryLogicError', 'Cannot divide by zero.', [1]) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot divide by zero.")
		/* r.expr(2.0) / 0 */

		suite.T().Log("About to run line #38: r.Expr(2.0).Div(0)")

		runAndAssert(suite.Suite, expected_, r.Expr(2.0).Div(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #38")
	}

	{
		// math_logic/div.yaml line #39
		/* err('ReqlQueryLogicError', 'Cannot divide by zero.', [1]) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot divide by zero.")
		/* r.expr(3) / 0.0 */

		suite.T().Log("About to run line #39: r.Expr(3).Div(0.0)")

		runAndAssert(suite.Suite, expected_, r.Expr(3).Div(0.0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	{
		// math_logic/div.yaml line #40
		/* err('ReqlQueryLogicError', 'Cannot divide by zero.', [1]) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot divide by zero.")
		/* r.expr(4.0) / 0.0 */

		suite.T().Log("About to run line #40: r.Expr(4.0).Div(0.0)")

		runAndAssert(suite.Suite, expected_, r.Expr(4.0).Div(0.0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #40")
	}

	{
		// math_logic/div.yaml line #41
		/* err('ReqlQueryLogicError', 'Cannot divide by zero.', [1]) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot divide by zero.")
		/* r.expr(0) / 0 */

		suite.T().Log("About to run line #41: r.Expr(0).Div(0)")

		runAndAssert(suite.Suite, expected_, r.Expr(0).Div(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #41")
	}

	{
		// math_logic/div.yaml line #42
		/* err('ReqlQueryLogicError', 'Cannot divide by zero.', [1]) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot divide by zero.")
		/* r.expr(0.0) / 0.0 */

		suite.T().Log("About to run line #42: r.Expr(0.0).Div(0.0)")

		runAndAssert(suite.Suite, expected_, r.Expr(0.0).Div(0.0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #42")
	}

	{
		// math_logic/div.yaml line #46
		/* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.")
		/* r.expr('a') / 0.8 */

		suite.T().Log("About to run line #46: r.Expr('a').Div(0.8)")

		runAndAssert(suite.Suite, expected_, r.Expr("a").Div(0.8), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #46")
	}

	{
		// math_logic/div.yaml line #50
		/* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [1]) */
		var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.")
		/* r.expr(1) / 'a' */

		suite.T().Log("About to run line #50: r.Expr(1).Div('a')")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Div("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #50")
	}
}
コード例 #2
0
func (suite *GeoOperationsSuite) TestCases() {
	suite.T().Log("Running GeoOperationsSuite: Test basic geometry operators")

	{
		// geo/operations.yaml line #5
		/* ("89011.26253835332") */
		var expected_ string = "89011.26253835332"
		/* r.distance(r.point(-122, 37), r.point(-123, 37)).coerce_to('STRING') */

		suite.T().Log("About to run line #5: r.Distance(r.Point(-122, 37), r.Point(-123, 37)).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Point(-122, 37), r.Point(-123, 37)).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #5")
	}

	{
		// geo/operations.yaml line #7
		/* ("110968.30443995494") */
		var expected_ string = "110968.30443995494"
		/* r.distance(r.point(-122, 37), r.point(-122, 36)).coerce_to('STRING') */

		suite.T().Log("About to run line #7: r.Distance(r.Point(-122, 37), r.Point(-122, 36)).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Point(-122, 37), r.Point(-122, 36)).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	{
		// geo/operations.yaml line #9
		/* true */
		var expected_ bool = true
		/* r.distance(r.point(-122, 37), r.point(-122, 36)).eq(r.distance(r.point(-122, 36), r.point(-122, 37))) */

		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)))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #9")
	}

	{
		// geo/operations.yaml line #11
		/* ("89011.26253835332") */
		var expected_ string = "89011.26253835332"
		/* r.point(-122, 37).distance(r.point(-123, 37)).coerce_to('STRING') */

		suite.T().Log("About to run line #11: r.Point(-122, 37).Distance(r.Point(-123, 37)).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Point(-122, 37).Distance(r.Point(-123, 37)).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #11")
	}

	// geo/operations.yaml line #13
	// someDist = r.distance(r.point(-122, 37), r.point(-123, 37))
	suite.T().Log("Possibly executing: var someDist r.Term = r.Distance(r.Point(-122, 37), r.Point(-123, 37))")

	someDist := r.Distance(r.Point(-122, 37), r.Point(-123, 37))
	_ = someDist // Prevent any noused variable errors

	{
		// geo/operations.yaml line #15
		/* true */
		var expected_ bool = true
		/* someDist.eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='m')) */

		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', }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #15")
	}

	{
		// geo/operations.yaml line #19
		/* true */
		var expected_ bool = true
		/* someDist.mul(1.0/1000.0).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='km')) */

		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', }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// geo/operations.yaml line #23
		/* true */
		var expected_ bool = true
		/* someDist.mul(1.0/1609.344).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='mi')) */

		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', }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #23")
	}

	{
		// geo/operations.yaml line #27
		/* true */
		var expected_ bool = true
		/* someDist.mul(1.0/0.3048).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='ft')) */

		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', }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #27")
	}

	{
		// geo/operations.yaml line #31
		/* true */
		var expected_ bool = true
		/* someDist.mul(1.0/1852.0).eq(r.distance(r.point(-122, 37), r.point(-123, 37), unit='nm')) */

		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', }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #31")
	}

	{
		// geo/operations.yaml line #35
		/* true */
		var expected_ bool = true
		/* someDist.eq(r.distance(r.point(-122, 37), r.point(-123, 37), geo_system='WGS84')) */

		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', }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #35")
	}

	{
		// geo/operations.yaml line #40
		/* true */
		var expected_ bool = true
		/* someDist.div(10).eq(r.distance(r.point(-122, 37), r.point(-123, 37), geo_system={'a':637813.7, 'f':(1.0/298.257223563)})) */

		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), }, }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #40")
	}

	{
		// geo/operations.yaml line #43
		/* ("0.01393875509649327") */
		var expected_ string = "0.01393875509649327"
		/* r.distance(r.point(-122, 37), r.point(-123, 37), geo_system='unit_sphere').coerce_to('STRING') */

		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')")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #43")
	}

	{
		// geo/operations.yaml line #47
		/* ("0") */
		var expected_ string = "0"
		/* r.distance(r.point(0, 0), r.point(0, 0)).coerce_to('STRING') */

		suite.T().Log("About to run line #47: r.Distance(r.Point(0, 0), r.Point(0, 0)).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Point(0, 0)).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #47")
	}

	{
		// geo/operations.yaml line #50
		/* ("40007862.917250897") */
		var expected_ string = "40007862.917250897"
		/* r.distance(r.point(0, 0), r.point(180, 0)).mul(2).coerce_to('STRING') */

		suite.T().Log("About to run line #50: r.Distance(r.Point(0, 0), r.Point(180, 0)).Mul(2).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Point(180, 0)).Mul(2).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #50")
	}

	{
		// geo/operations.yaml line #52
		/* ("40007862.917250897") */
		var expected_ string = "40007862.917250897"
		/* r.distance(r.point(0, -90), r.point(0, 90)).mul(2).coerce_to('STRING') */

		suite.T().Log("About to run line #52: r.Distance(r.Point(0, -90), r.Point(0, 90)).Mul(2).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, -90), r.Point(0, 90)).Mul(2).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #52")
	}

	{
		// geo/operations.yaml line #54
		/* ("0") */
		var expected_ string = "0"
		/* r.distance(r.point(0, 0), r.line([0,0], [0,1])).coerce_to('STRING') */

		suite.T().Log("About to run line #54: r.Distance(r.Point(0, 0), r.Line([]interface{}{0, 0}, []interface{}{0, 1})).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Line([]interface{}{0, 0}, []interface{}{0, 1})).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #54")
	}

	{
		// geo/operations.yaml line #56
		/* ("0") */
		var expected_ string = "0"
		/* r.distance(r.line([0,0], [0,1]), r.point(0, 0)).coerce_to('STRING') */

		suite.T().Log("About to run line #56: r.Distance(r.Line([]interface{}{0, 0}, []interface{}{0, 1}), r.Point(0, 0)).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Line([]interface{}{0, 0}, []interface{}{0, 1}), r.Point(0, 0)).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #56")
	}

	{
		// geo/operations.yaml line #58
		/* true */
		var expected_ bool = true
		/* 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))) */

		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)))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #58")
	}

	{
		// geo/operations.yaml line #60
		/* ("492471.4990055255") */
		var expected_ string = "492471.4990055255"
		/* r.distance(r.point(0, 0), r.line([5,-1], [4,2])).coerce_to('STRING') */

		suite.T().Log("About to run line #60: r.Distance(r.Point(0, 0), r.Line([]interface{}{5, -1}, []interface{}{4, 2})).CoerceTo('STRING')")

		runAndAssert(suite.Suite, expected_, r.Distance(r.Point(0, 0), r.Line([]interface{}{5, -1}, []interface{}{4, 2})).CoerceTo("STRING"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #60")
	}

	{
		// geo/operations.yaml line #62
		/* ("492471.4990055255") */
		var expected_ string = "492471.4990055255"
		/* r.distance(r.point(0, 0), r.polygon([5,-1], [4,2], [10,10])).coerce_to('STRING') */

		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')")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #62")
	}

	{
		// geo/operations.yaml line #64
		/* ("0") */
		var expected_ string = "0"
		/* r.distance(r.point(0, 0), r.polygon([0,-1], [0,1], [10,10])).coerce_to('STRING') */

		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')")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #64")
	}

	{
		// geo/operations.yaml line #66
		/* ("0") */
		var expected_ string = "0"
		/* r.distance(r.point(0.5, 0.5), r.polygon([0,-1], [0,1], [10,10])).coerce_to('STRING') */

		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')")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #66")
	}

	{
		// geo/operations.yaml line #71
		/* false */
		var expected_ bool = false
		/* r.circle([0,0], 1, fill=false).eq(r.circle([0,0], 1, fill=true)) */

		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, }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #71")
	}

	{
		// geo/operations.yaml line #75
		/* true */
		var expected_ bool = true
		/* r.circle([0,0], 1, fill=false).fill().eq(r.circle([0,0], 1, fill=true)) */

		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, }))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #75")
	}

	{
		// geo/operations.yaml line #80
		/* ({'$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'}) */
		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"}
		/* 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])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #80")
	}

	{
		// geo/operations.yaml line #82
		/* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.")
		/* 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])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #82")
	}

	{
		// geo/operations.yaml line #84
		/* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.")
		/* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,0], [2,0], [2,2], [0,2])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #84")
	}

	{
		// geo/operations.yaml line #86
		/* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.")
		/* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,-2], [1,-2], [-1,1], [0,-1])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #86")
	}

	{
		// geo/operations.yaml line #88
		/* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.")
		/* r.polygon([0,0], [1,0], [1,1], [0,1]).polygon_sub(r.polygon([0,-1], [1,-1], [1,0], [0,0])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #88")
	}

	{
		// geo/operations.yaml line #90
		/* err('ReqlQueryLogicError', 'The second argument to `polygon_sub` is not contained in the first one.', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "The second argument to `polygon_sub` is not contained in the first one.")
		/* 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])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #90")
	}

	{
		// geo/operations.yaml line #92
		/* ({'$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'}) */
		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"}
		/* 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])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #92")
	}

	{
		// geo/operations.yaml line #94
		/* err('ReqlQueryLogicError', 'Expected a Polygon with only an outer shell.  This one has holes.', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "Expected a Polygon with only an outer shell.  This one has holes.")
		/* 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]))) */

		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})))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #94")
	}

	{
		// geo/operations.yaml line #96
		/* err('ReqlQueryLogicError', 'Expected a Polygon but found a LineString.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "Expected a Polygon but found a LineString.")
		/* 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])) */

		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}))")

		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{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #96")
	}
}
コード例 #3
0
func (suite *GeoPrimitivesSuite) TestCases() {
	suite.T().Log("Running GeoPrimitivesSuite: Test geometric primitive constructors")

	{
		// geo/primitives.yaml line #5
		/* ({'$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'}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, -9.04369477050382e-06}, []interface{}{-7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{0, -9.04369477050382e-06}}}, "type": "Polygon"}
		/* r.circle([0,0], 1, num_vertices=3) */

		suite.T().Log("About to run line #5: r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{NumVertices: 3, })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{NumVertices: 3}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #5")
	}

	{
		// geo/primitives.yaml line #10
		/* ({'$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'}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, -9.04369477050382e-06}, []interface{}{-7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{0, -9.04369477050382e-06}}}, "type": "Polygon"}
		/* r.circle(r.point(0,0), 1, num_vertices=3) */

		suite.T().Log("About to run line #10: r.Circle(r.Point(0, 0), 1).OptArgs(r.CircleOpts{NumVertices: 3, })")

		runAndAssert(suite.Suite, expected_, r.Circle(r.Point(0, 0), 1).OptArgs(r.CircleOpts{NumVertices: 3}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #10")
	}

	{
		// geo/primitives.yaml line #15
		/* ({'$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'}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{0, -9.04369477050382e-06}, []interface{}{-7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{0, -9.04369477050382e-06}}, "type": "LineString"}
		/* r.circle([0,0], 1, num_vertices=3, fill=false) */

		suite.T().Log("About to run line #15: r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{NumVertices: 3, Fill: false, })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{NumVertices: 3, Fill: false}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #15")
	}

	{
		// geo/primitives.yaml line #20
		/* 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]) */
		var expected_ Err = 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.")
		/* r.circle([0,0], 14000000, num_vertices=3) */

		suite.T().Log("About to run line #20: r.Circle([]interface{}{0, 0}, 14000000).OptArgs(r.CircleOpts{NumVertices: 3, })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 14000000).OptArgs(r.CircleOpts{NumVertices: 3}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #20")
	}

	{
		// geo/primitives.yaml line #25
		/* ({'$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'}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, -9.04369477050382e-06}, []interface{}{-7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{0, -9.04369477050382e-06}}}, "type": "Polygon"}
		/* r.circle([0,0], 1, num_vertices=3, geo_system='WGS84') */

		suite.T().Log("About to run line #25: r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{NumVertices: 3, GeoSystem: 'WGS84', })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 1).OptArgs(r.CircleOpts{NumVertices: 3, GeoSystem: "WGS84"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #25")
	}

	{
		// geo/primitives.yaml line #30
		/* 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]) */
		var expected_ Err = 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.")
		/* r.circle([0,0], 2, num_vertices=3, geo_system='unit_sphere') */

		suite.T().Log("About to run line #30: r.Circle([]interface{}{0, 0}, 2).OptArgs(r.CircleOpts{NumVertices: 3, GeoSystem: 'unit_sphere', })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 2).OptArgs(r.CircleOpts{NumVertices: 3, GeoSystem: "unit_sphere"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #30")
	}

	{
		// geo/primitives.yaml line #35
		/* ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0, -5.729577951308232], [-4.966092947444857, 2.861205754495701], [4.966092947444857, 2.861205754495701], [0, -5.729577951308232]]], 'type':'Polygon'}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, -5.729577951308232}, []interface{}{-4.966092947444857, 2.861205754495701}, []interface{}{4.966092947444857, 2.861205754495701}, []interface{}{0, -5.729577951308232}}}, "type": "Polygon"}
		/* r.circle([0,0], 0.1, num_vertices=3, geo_system='unit_sphere') */

		suite.T().Log("About to run line #35: r.Circle([]interface{}{0, 0}, 0.1).OptArgs(r.CircleOpts{NumVertices: 3, GeoSystem: 'unit_sphere', })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, 0.1).OptArgs(r.CircleOpts{NumVertices: 3, GeoSystem: "unit_sphere"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #35")
	}

	{
		// geo/primitives.yaml line #42
		/* ({'$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'}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, -9.04369477050382e-06}, []interface{}{-7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{0, -9.04369477050382e-06}}}, "type": "Polygon"}
		/* r.circle([0,0], 1.0/1000.0, num_vertices=3, unit='km') */

		suite.T().Log("About to run line #42: r.Circle([]interface{}{0, 0}, r.Div(1.0, 1000.0)).OptArgs(r.CircleOpts{NumVertices: 3, Unit: 'km', })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, r.Div(1.0, 1000.0)).OptArgs(r.CircleOpts{NumVertices: 3, Unit: "km"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #42")
	}

	{
		// geo/primitives.yaml line #47
		/* ({'$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'}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{[]interface{}{[]interface{}{0, -9.04369477050382e-06}, []interface{}{-7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{7.779638566553426e-06, 4.5218473852518965e-06}, []interface{}{0, -9.04369477050382e-06}}}, "type": "Polygon"}
		/* r.circle([0,0], 1.0/1609.344, num_vertices=3, unit='mi') */

		suite.T().Log("About to run line #47: r.Circle([]interface{}{0, 0}, r.Div(1.0, 1609.344)).OptArgs(r.CircleOpts{NumVertices: 3, Unit: 'mi', })")

		runAndAssert(suite.Suite, expected_, r.Circle([]interface{}{0, 0}, r.Div(1.0, 1609.344)).OptArgs(r.CircleOpts{NumVertices: 3, Unit: "mi"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #47")
	}
}
コード例 #4
0
func (suite *MathLogicAliasesSuite) TestCases() {
	suite.T().Log("Running MathLogicAliasesSuite: Test named aliases for math and logic operators")

	{
		// math_logic/aliases.yaml line #5
		/* 1 */
		var expected_ int = 1
		/* r.expr(0).add(1) */

		suite.T().Log("About to run line #5: r.Expr(0).Add(1)")

		runAndAssert(suite.Suite, expected_, r.Expr(0).Add(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #5")
	}

	{
		// math_logic/aliases.yaml line #6
		/* 1 */
		var expected_ int = 1
		/* r.add(0, 1) */

		suite.T().Log("About to run line #6: r.Add(0, 1)")

		runAndAssert(suite.Suite, expected_, r.Add(0, 1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// math_logic/aliases.yaml line #7
		/* 1 */
		var expected_ int = 1
		/* r.expr(2).sub(1) */

		suite.T().Log("About to run line #7: r.Expr(2).Sub(1)")

		runAndAssert(suite.Suite, expected_, r.Expr(2).Sub(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	{
		// math_logic/aliases.yaml line #8
		/* 1 */
		var expected_ int = 1
		/* r.sub(2, 1) */

		suite.T().Log("About to run line #8: r.Sub(2, 1)")

		runAndAssert(suite.Suite, expected_, r.Sub(2, 1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #8")
	}

	{
		// math_logic/aliases.yaml line #9
		/* 1 */
		var expected_ int = 1
		/* r.expr(2).div(2) */

		suite.T().Log("About to run line #9: r.Expr(2).Div(2)")

		runAndAssert(suite.Suite, expected_, r.Expr(2).Div(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #9")
	}

	{
		// math_logic/aliases.yaml line #10
		/* 1 */
		var expected_ int = 1
		/* r.div(2, 2) */

		suite.T().Log("About to run line #10: r.Div(2, 2)")

		runAndAssert(suite.Suite, expected_, r.Div(2, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #10")
	}

	{
		// math_logic/aliases.yaml line #11
		/* 1 */
		var expected_ int = 1
		/* r.expr(1).mul(1) */

		suite.T().Log("About to run line #11: r.Expr(1).Mul(1)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Mul(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #11")
	}

	{
		// math_logic/aliases.yaml line #12
		/* 1 */
		var expected_ int = 1
		/* r.mul(1, 1) */

		suite.T().Log("About to run line #12: r.Mul(1, 1)")

		runAndAssert(suite.Suite, expected_, r.Mul(1, 1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #12")
	}

	{
		// math_logic/aliases.yaml line #13
		/* 1 */
		var expected_ int = 1
		/* r.expr(1).mod(2) */

		suite.T().Log("About to run line #13: r.Expr(1).Mod(2)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Mod(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #13")
	}

	{
		// math_logic/aliases.yaml line #14
		/* 1 */
		var expected_ int = 1
		/* r.mod(1, 2) */

		suite.T().Log("About to run line #14: r.Mod(1, 2)")

		runAndAssert(suite.Suite, expected_, r.Mod(1, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #14")
	}

	{
		// math_logic/aliases.yaml line #25
		/* True */
		var expected_ bool = true
		/* r.expr(True).and_(True) */

		suite.T().Log("About to run line #25: r.Expr(true).And(true)")

		runAndAssert(suite.Suite, expected_, r.Expr(true).And(true), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #25")
	}

	{
		// math_logic/aliases.yaml line #26
		/* True */
		var expected_ bool = true
		/* r.expr(True).or_(True) */

		suite.T().Log("About to run line #26: r.Expr(true).Or(true)")

		runAndAssert(suite.Suite, expected_, r.Expr(true).Or(true), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #26")
	}

	{
		// math_logic/aliases.yaml line #27
		/* True */
		var expected_ bool = true
		/* r.and_(True, True) */

		suite.T().Log("About to run line #27: r.And(true, true)")

		runAndAssert(suite.Suite, expected_, r.And(true, true), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #27")
	}

	{
		// math_logic/aliases.yaml line #28
		/* True */
		var expected_ bool = true
		/* r.or_(True, True) */

		suite.T().Log("About to run line #28: r.Or(true, true)")

		runAndAssert(suite.Suite, expected_, r.Or(true, true), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #28")
	}

	{
		// math_logic/aliases.yaml line #29
		/* True */
		var expected_ bool = true
		/* r.expr(False).not_() */

		suite.T().Log("About to run line #29: r.Expr(false).Not()")

		runAndAssert(suite.Suite, expected_, r.Expr(false).Not(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #29")
	}

	{
		// math_logic/aliases.yaml line #30
		/* True */
		var expected_ bool = true
		/* r.not_(False) */

		suite.T().Log("About to run line #30: r.Not(false)")

		runAndAssert(suite.Suite, expected_, r.Not(false), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #30")
	}

	{
		// math_logic/aliases.yaml line #34
		/* True */
		var expected_ bool = true
		/* r.expr(1).eq(1) */

		suite.T().Log("About to run line #34: r.Expr(1).Eq(1)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Eq(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #34")
	}

	{
		// math_logic/aliases.yaml line #35
		/* True */
		var expected_ bool = true
		/* r.expr(1).ne(2) */

		suite.T().Log("About to run line #35: r.Expr(1).Ne(2)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Ne(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #35")
	}

	{
		// math_logic/aliases.yaml line #36
		/* True */
		var expected_ bool = true
		/* r.expr(1).lt(2) */

		suite.T().Log("About to run line #36: r.Expr(1).Lt(2)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Lt(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #36")
	}

	{
		// math_logic/aliases.yaml line #37
		/* True */
		var expected_ bool = true
		/* r.expr(1).gt(0) */

		suite.T().Log("About to run line #37: r.Expr(1).Gt(0)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Gt(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	{
		// math_logic/aliases.yaml line #38
		/* True */
		var expected_ bool = true
		/* r.expr(1).le(1) */

		suite.T().Log("About to run line #38: r.Expr(1).Le(1)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Le(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #38")
	}

	{
		// math_logic/aliases.yaml line #39
		/* True */
		var expected_ bool = true
		/* r.expr(1).ge(1) */

		suite.T().Log("About to run line #39: r.Expr(1).Ge(1)")

		runAndAssert(suite.Suite, expected_, r.Expr(1).Ge(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	{
		// math_logic/aliases.yaml line #40
		/* True */
		var expected_ bool = true
		/* r.eq(1, 1) */

		suite.T().Log("About to run line #40: r.Eq(1, 1)")

		runAndAssert(suite.Suite, expected_, r.Eq(1, 1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #40")
	}

	{
		// math_logic/aliases.yaml line #41
		/* True */
		var expected_ bool = true
		/* r.ne(1, 2) */

		suite.T().Log("About to run line #41: r.Ne(1, 2)")

		runAndAssert(suite.Suite, expected_, r.Ne(1, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #41")
	}

	{
		// math_logic/aliases.yaml line #42
		/* True */
		var expected_ bool = true
		/* r.lt(1, 2) */

		suite.T().Log("About to run line #42: r.Lt(1, 2)")

		runAndAssert(suite.Suite, expected_, r.Lt(1, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #42")
	}

	{
		// math_logic/aliases.yaml line #43
		/* True */
		var expected_ bool = true
		/* r.gt(1, 0) */

		suite.T().Log("About to run line #43: r.Gt(1, 0)")

		runAndAssert(suite.Suite, expected_, r.Gt(1, 0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #43")
	}

	{
		// math_logic/aliases.yaml line #44
		/* True */
		var expected_ bool = true
		/* r.le(1, 1) */

		suite.T().Log("About to run line #44: r.Le(1, 1)")

		runAndAssert(suite.Suite, expected_, r.Le(1, 1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #44")
	}

	{
		// math_logic/aliases.yaml line #45
		/* True */
		var expected_ bool = true
		/* r.ge(1, 1) */

		suite.T().Log("About to run line #45: r.Ge(1, 1)")

		runAndAssert(suite.Suite, expected_, r.Ge(1, 1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #45")
	}
}