Exemplo n.º 1
0
func (suite *DatumTypeofSuite) TestCases() {
	suite.T().Log("Running DatumTypeofSuite: These tests test the type of command")

	{
		// datum/typeof.yaml line #5
		/* 'NULL' */
		var expected_ string = "NULL"
		/* r.expr(null).type_of() */

		suite.T().Log("About to run line #5: r.Expr(nil).TypeOf()")

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

	{
		// datum/typeof.yaml line #9
		/* 'NULL' */
		var expected_ string = "NULL"
		/* r.type_of(null) */

		suite.T().Log("About to run line #9: r.TypeOf(nil)")

		runAndAssert(suite.Suite, expected_, r.TypeOf(nil), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #9")
	}
}
Exemplo n.º 2
0
func (suite *DatumUuidSuite) TestCases() {
	suite.T().Log("Running DatumUuidSuite: Test that UUIDs work")

	{
		// datum/uuid.yaml line #3
		/* uuid() */
		var expected_ compare.Regex = compare.IsUUID()
		/* r.uuid() */

		suite.T().Log("About to run line #3: r.UUID()")

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

	{
		// datum/uuid.yaml line #5
		/* uuid() */
		var expected_ compare.Regex = compare.IsUUID()
		/* r.expr(r.uuid()) */

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

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

	{
		// datum/uuid.yaml line #7
		/* 'STRING' */
		var expected_ string = "STRING"
		/* r.type_of(r.uuid()) */

		suite.T().Log("About to run line #7: r.TypeOf(r.UUID())")

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

	{
		// datum/uuid.yaml line #9
		/* true */
		var expected_ bool = true
		/* r.uuid().ne(r.uuid()) */

		suite.T().Log("About to run line #9: r.UUID().Ne(r.UUID())")

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

	{
		// datum/uuid.yaml line #11
		/* ('97dd10a5-4fc4-554f-86c5-0d2c2e3d5330') */
		var expected_ string = "97dd10a5-4fc4-554f-86c5-0d2c2e3d5330"
		/* r.uuid('magic') */

		suite.T().Log("About to run line #11: r.UUID('magic')")

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

	{
		// datum/uuid.yaml line #13
		/* true */
		var expected_ bool = true
		/* r.uuid('magic').eq(r.uuid('magic')) */

		suite.T().Log("About to run line #13: r.UUID('magic').Eq(r.UUID('magic'))")

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

	{
		// datum/uuid.yaml line #15
		/* true */
		var expected_ bool = true
		/* r.uuid('magic').ne(r.uuid('beans')) */

		suite.T().Log("About to run line #15: r.UUID('magic').Ne(r.UUID('beans'))")

		runAndAssert(suite.Suite, expected_, r.UUID("magic").Ne(r.UUID("beans")), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #15")
	}

	{
		// datum/uuid.yaml line #17
		/* 10 */
		var expected_ int = 10
		/* r.expr([1,2,3,4,5,6,7,8,9,10]).map(lambda u:r.uuid()).distinct().count() */

		suite.T().Log("About to run line #17: r.Expr([]interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}).Map(func(u r.Term) interface{} { return r.UUID()}).Distinct().Count()")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}).Map(func(u r.Term) interface{} { return r.UUID() }).Distinct().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #17")
	}
}