func (suite *MetaCompositeSuite) TestCases() { suite.T().Log("Running MetaCompositeSuite: Tests meta operations in composite queries") { // meta/composite.py.yaml line #4 /* ({'dbs_created':3,'config_changes':arrlen(3)}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"dbs_created": 3, "config_changes": arrlen(3)} /* r.expr([1,2,3]).for_each(r.db_create('db_' + r.row.coerce_to('string'))) */ suite.T().Log("About to run line #4: r.Expr([]interface{}{1, 2, 3}).ForEach(r.DBCreate(r.Add('db_', r.Row.CoerceTo('string'))))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(r.DBCreate(r.Add("db_", r.Row.CoerceTo("string")))), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } { // meta/composite.py.yaml line #8 /* partial({'tables_created':9}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 9}) /* r.db_list().set_difference(["rethinkdb", "test"]).for_each(lambda db_name: r.expr([1,2,3]).for_each(lambda i: r.db(db_name).table_create('tbl_' + i.coerce_to('string')))) */ suite.T().Log("About to run line #8: r.DBList().SetDifference([]interface{}{'rethinkdb', 'test'}).ForEach(func(db_name r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3}).ForEach(func(i r.Term) interface{} { return r.DB(db_name).TableCreate(r.Add('tbl_', i.CoerceTo('string')))})})") runAndAssert(suite.Suite, expected_, r.DBList().SetDifference([]interface{}{"rethinkdb", "test"}).ForEach(func(db_name r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3}).ForEach(func(i r.Term) interface{} { return r.DB(db_name).TableCreate(r.Add("tbl_", i.CoerceTo("string"))) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // meta/composite.py.yaml line #13 /* partial({'dbs_dropped':3,'tables_dropped':9}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 3, "tables_dropped": 9}) /* r.db_list().set_difference(["rethinkdb", "test"]).for_each(r.db_drop(r.row)) */ suite.T().Log("About to run line #13: r.DBList().SetDifference([]interface{}{'rethinkdb', 'test'}).ForEach(r.DBDrop(r.Row))") runAndAssert(suite.Suite, expected_, r.DBList().SetDifference([]interface{}{"rethinkdb", "test"}).ForEach(r.DBDrop(r.Row)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } }
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") } }
func (suite *MathLogicMathSuite) TestCases() { suite.T().Log("Running MathLogicMathSuite: Tests of nested arithmetic expressions") { // math_logic/math.yaml line #4 /* 1 */ var expected_ int = 1 /* (((4 + 2 * (r.expr(26) % 18)) / 5) - 3) */ suite.T().Log("About to run line #4: r.Add(4, r.Mul(2, r.Expr(26).Mod(18))).Div(5).Sub(3)") runAndAssert(suite.Suite, expected_, r.Add(4, r.Mul(2, r.Expr(26).Mod(18))).Div(5).Sub(3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } }
func Example() { session, err := r.Connect(r.ConnectOpts{ Address: url, }) if err != nil { log.Fatalln(err) } res, err := r.Expr("Hello World").Run(session) if err != nil { log.Fatalln(err) } var response string err = res.One(&response) if err != nil { log.Fatalln(err) } fmt.Println(response) // Output: // Hello World }
func (suite *TimesIndexSuite) TestCases() { suite.T().Log("Running TimesIndexSuite: secondary indexes on times") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors // times/index.yaml line #7 // ts={"timezone":"-07:00","epoch_time":1375445162.0872,"$reql_type$":"TIME"} suite.T().Log("Possibly executing: var ts map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445162.0872, '$reql_type$': 'TIME', }") ts := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445162.0872, "$reql_type$": "TIME"} _ = ts // Prevent any noused variable errors // times/index.yaml line #11 // t1={"timezone":"-07:00","epoch_time":1375445163.0872,"$reql_type$":"TIME"} suite.T().Log("Possibly executing: var t1 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.0872, '$reql_type$': 'TIME', }") t1 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.0872, "$reql_type$": "TIME"} _ = t1 // Prevent any noused variable errors // times/index.yaml line #15 // t2={"timezone":"-07:00","epoch_time":1375445163.08832,"$reql_type$":"TIME"} suite.T().Log("Possibly executing: var t2 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.08832, '$reql_type$': 'TIME', }") t2 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.08832, "$reql_type$": "TIME"} _ = t2 // Prevent any noused variable errors // times/index.yaml line #19 // t3={"timezone":"-07:00","epoch_time":1375445163.08943,"$reql_type$":"TIME"} suite.T().Log("Possibly executing: var t3 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.08943, '$reql_type$': 'TIME', }") t3 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.08943, "$reql_type$": "TIME"} _ = t3 // Prevent any noused variable errors // times/index.yaml line #23 // t4={"timezone":"-07:00","epoch_time":1375445163.09055,"$reql_type$":"TIME"} suite.T().Log("Possibly executing: var t4 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.09055, '$reql_type$': 'TIME', }") t4 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.09055, "$reql_type$": "TIME"} _ = t4 // Prevent any noused variable errors // times/index.yaml line #27 // t5={"timezone":"-07:00","epoch_time":1375445163.09166,"$reql_type$":"TIME"} suite.T().Log("Possibly executing: var t5 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.09166, '$reql_type$': 'TIME', }") t5 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.09166, "$reql_type$": "TIME"} _ = t5 // Prevent any noused variable errors // times/index.yaml line #31 // te={"timezone":"-07:00","epoch_time":1375445164.0872,"$reql_type$":"TIME"} suite.T().Log("Possibly executing: var te map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445164.0872, '$reql_type$': 'TIME', }") te := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445164.0872, "$reql_type$": "TIME"} _ = te // Prevent any noused variable errors // times/index.yaml line #36 // trows = [{'id':t1}, {'id':t2}, {'id':t3}, {'id':t4}, {'id':t5}] suite.T().Log("Possibly executing: var trows []interface{} = []interface{}{map[interface{}]interface{}{'id': t1, }, map[interface{}]interface{}{'id': t2, }, map[interface{}]interface{}{'id': t3, }, map[interface{}]interface{}{'id': t4, }, map[interface{}]interface{}{'id': t5, }}") trows := []interface{}{map[interface{}]interface{}{"id": t1}, map[interface{}]interface{}{"id": t2}, map[interface{}]interface{}{"id": t3}, map[interface{}]interface{}{"id": t4}, map[interface{}]interface{}{"id": t5}} _ = trows // Prevent any noused variable errors { // times/index.yaml line #37 /* 5 */ var expected_ int = 5 /* tbl.insert(trows)['inserted'] */ suite.T().Log("About to run line #37: tbl.Insert(trows).AtIndex('inserted')") runAndAssert(suite.Suite, expected_, tbl.Insert(trows).AtIndex("inserted"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } // times/index.yaml line #41 // bad_insert = [{'id':r.expr(t1).in_timezone("Z")}] suite.T().Log("Possibly executing: var bad_insert []interface{} = []interface{}{map[interface{}]interface{}{'id': r.Expr(t1).InTimezone('Z'), }}") bad_insert := []interface{}{map[interface{}]interface{}{"id": r.Expr(t1).InTimezone("Z")}} _ = bad_insert // Prevent any noused variable errors { // times/index.yaml line #42 /* ("Duplicate primary key `id`:\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"-07:00\"\n\t}\n}\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"+00:00\"\n\t}\n}") */ var expected_ string = "Duplicate primary key `id`:\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"-07:00\"\n\t}\n}\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"+00:00\"\n\t}\n}" /* tbl.insert(bad_insert)['first_error'] */ suite.T().Log("About to run line #42: tbl.Insert(bad_insert).AtIndex('first_error')") runAndAssert(suite.Suite, expected_, tbl.Insert(bad_insert).AtIndex("first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // times/index.yaml line #46 /* 5 */ var expected_ int = 5 /* tbl.between(ts, te).count() */ suite.T().Log("About to run line #46: tbl.Between(ts, te).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(ts, te).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // times/index.yaml line #48 /* 3 */ var expected_ int = 3 /* tbl.between(t1, t4).count() */ suite.T().Log("About to run line #48: tbl.Between(t1, t4).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } { // times/index.yaml line #51 /* 4 */ var expected_ int = 4 /* tbl.between(t1, t4, right_bound='closed').count() */ suite.T().Log("About to run line #51: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // times/index.yaml line #54 /* 5 */ var expected_ int = 5 /* tbl.between(r.expr(ts).in_timezone("+06:00"), te).count() */ suite.T().Log("About to run line #54: tbl.Between(r.Expr(ts).InTimezone('+06:00'), te).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(ts).InTimezone("+06:00"), te).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // times/index.yaml line #56 /* 3 */ var expected_ int = 3 /* tbl.between(t1, r.expr(t4).in_timezone("+08:00")).count() */ suite.T().Log("About to run line #56: tbl.Between(t1, r.Expr(t4).InTimezone('+08:00')).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, r.Expr(t4).InTimezone("+08:00")).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #56") } { // times/index.yaml line #59 /* 4 */ var expected_ int = 4 /* tbl.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed').count() */ suite.T().Log("About to run line #59: tbl.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // times/index.yaml line #64 /* 5 */ var expected_ int = 5 /* tbl.update(lambda row:{'a':row['id']})['replaced'] */ suite.T().Log("About to run line #64: tbl.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id'), }}).AtIndex('replaced')") runAndAssert(suite.Suite, expected_, tbl.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id")} }).AtIndex("replaced"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #64") } { // times/index.yaml line #67 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl.index_create('a') */ suite.T().Log("About to run line #67: tbl.IndexCreate('a')") runAndAssert(suite.Suite, expected_, tbl.IndexCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #67") } { // times/index.yaml line #69 /* 1 */ var expected_ int = 1 /* tbl.index_wait('a').count() */ suite.T().Log("About to run line #69: tbl.IndexWait('a').Count()") runAndAssert(suite.Suite, expected_, tbl.IndexWait("a").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } { // times/index.yaml line #73 /* 5 */ var expected_ int = 5 /* tbl.between(ts, te, index='a').count() */ suite.T().Log("About to run line #73: tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // times/index.yaml line #77 /* 3 */ var expected_ int = 3 /* tbl.between(t1, t4, index='a').count() */ suite.T().Log("About to run line #77: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #77") } { // times/index.yaml line #81 /* 4 */ var expected_ int = 4 /* tbl.between(t1, t4, right_bound='closed', index='a').count() */ suite.T().Log("About to run line #81: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'a', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "a"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // times/index.yaml line #85 /* 5 */ var expected_ int = 5 /* tbl.between(r.expr(ts).in_timezone("+06:00"), te, index='a').count() */ suite.T().Log("About to run line #85: tbl.Between(r.Expr(ts).InTimezone('+06:00'), te).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(ts).InTimezone("+06:00"), te).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } { // times/index.yaml line #89 /* 3 */ var expected_ int = 3 /* tbl.between(t1, r.expr(t4).in_timezone("+08:00"), index='a').count() */ suite.T().Log("About to run line #89: tbl.Between(t1, r.Expr(t4).InTimezone('+08:00')).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, r.Expr(t4).InTimezone("+08:00")).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // times/index.yaml line #93 /* 4 */ var expected_ int = 4 /* tbl.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed', index='a').count() */ suite.T().Log("About to run line #93: tbl.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'a', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "a"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } { // times/index.yaml line #98 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl.index_create('b', lambda row:r.branch(row['id'] < t4, row['a'], null)) */ suite.T().Log("About to run line #98: tbl.IndexCreateFunc('b', func(row r.Term) interface{} { return r.Branch(row.AtIndex('id').Lt(t4), row.AtIndex('a'), nil)})") runAndAssert(suite.Suite, expected_, tbl.IndexCreateFunc("b", func(row r.Term) interface{} { return r.Branch(row.AtIndex("id").Lt(t4), row.AtIndex("a"), nil) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #98") } { // times/index.yaml line #101 /* 1 */ var expected_ int = 1 /* tbl.index_wait('b').count() */ suite.T().Log("About to run line #101: tbl.IndexWait('b').Count()") runAndAssert(suite.Suite, expected_, tbl.IndexWait("b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // times/index.yaml line #105 /* 1 */ var expected_ int = 1 /* tbl.index_wait('b').count() */ suite.T().Log("About to run line #105: tbl.IndexWait('b').Count()") runAndAssert(suite.Suite, expected_, tbl.IndexWait("b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // times/index.yaml line #109 /* 3 */ var expected_ int = 3 /* tbl.between(ts, te, index='b').count() */ suite.T().Log("About to run line #109: tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } { // times/index.yaml line #113 /* 3 */ var expected_ int = 3 /* tbl.between(t1, t4, index='b').count() */ suite.T().Log("About to run line #113: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // times/index.yaml line #117 /* 3 */ var expected_ int = 3 /* tbl.between(t1, t4, right_bound='closed', index='b').count() */ suite.T().Log("About to run line #117: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'b', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "b"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #117") } { // times/index.yaml line #121 /* 3 */ var expected_ int = 3 /* tbl.between(r.expr(ts).in_timezone("+06:00"), te, index='b').count() */ suite.T().Log("About to run line #121: tbl.Between(r.Expr(ts).InTimezone('+06:00'), te).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(ts).InTimezone("+06:00"), te).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #121") } { // times/index.yaml line #125 /* 3 */ var expected_ int = 3 /* tbl.between(t1, r.expr(t4).in_timezone("+08:00"), index='b').count() */ suite.T().Log("About to run line #125: tbl.Between(t1, r.Expr(t4).InTimezone('+08:00')).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(t1, r.Expr(t4).InTimezone("+08:00")).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // times/index.yaml line #129 /* 3 */ var expected_ int = 3 /* tbl.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed', index='b').count() */ suite.T().Log("About to run line #129: tbl.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'b', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "b"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #129") } // times/index.yaml line #135 // oldtime = datetime.fromtimestamp(1375147296.681, PacificTimeZone()) suite.T().Log("Possibly executing: var oldtime time.Time = Ast.Fromtimestamp(1375147296.681, PacificTimeZone())") oldtime := Ast.Fromtimestamp(1375147296.681, PacificTimeZone()) _ = oldtime // Prevent any noused variable errors // times/index.yaml line #139 // curtime = datetime.now() suite.T().Log("Possibly executing: var curtime time.Time = Ast.Now()") curtime := Ast.Now() _ = curtime // Prevent any noused variable errors { // times/index.yaml line #142 /* 1 */ var expected_ int = 1 /* tbl.insert([{'id':oldtime}])['inserted'] */ suite.T().Log("About to run line #142: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': oldtime, }}).AtIndex('inserted')") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": oldtime}}).AtIndex("inserted"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #142") } { // times/index.yaml line #148 /* ("PTYPE<TIME>") */ var expected_ string = "PTYPE<TIME>" /* tbl.get(oldtime)['id'].type_of() */ suite.T().Log("About to run line #148: tbl.Get(oldtime).AtIndex('id').TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Get(oldtime).AtIndex("id").TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #148") } }
func (suite *TimesTimeArithSuite) TestCases() { suite.T().Log("Running TimesTimeArithSuite: Test basic time arithmetic") // times/time_arith.yaml line #3 // rt1 = 1375147296.681 suite.T().Log("Possibly executing: var rt1 float64 = 1375147296.681") rt1 := 1375147296.681 _ = rt1 // Prevent any noused variable errors // times/time_arith.yaml line #4 // rt2 = 1375147296.682 suite.T().Log("Possibly executing: var rt2 float64 = 1375147296.682") rt2 := 1375147296.682 _ = rt2 // Prevent any noused variable errors // times/time_arith.yaml line #5 // rt3 = 1375147297.681 suite.T().Log("Possibly executing: var rt3 float64 = 1375147297.681") rt3 := 1375147297.681 _ = rt3 // Prevent any noused variable errors // times/time_arith.yaml line #6 // rt4 = 2375147296.681 suite.T().Log("Possibly executing: var rt4 float64 = 2375147296.681") rt4 := 2375147296.681 _ = rt4 // Prevent any noused variable errors // times/time_arith.yaml line #7 // rts = [rt1, rt2, rt3, rt4] suite.T().Log("Possibly executing: var rts []interface{} = []interface{}{rt1, rt2, rt3, rt4}") rts := []interface{}{rt1, rt2, rt3, rt4} _ = rts // Prevent any noused variable errors // times/time_arith.yaml line #9 // t1 = r.epoch_time(rt1) suite.T().Log("Possibly executing: var t1 r.Term = r.EpochTime(rt1)") t1 := r.EpochTime(rt1) _ = t1 // Prevent any noused variable errors // times/time_arith.yaml line #10 // t2 = r.epoch_time(rt2) suite.T().Log("Possibly executing: var t2 r.Term = r.EpochTime(rt2)") t2 := r.EpochTime(rt2) _ = t2 // Prevent any noused variable errors // times/time_arith.yaml line #11 // t3 = r.epoch_time(rt3) suite.T().Log("Possibly executing: var t3 r.Term = r.EpochTime(rt3)") t3 := r.EpochTime(rt3) _ = t3 // Prevent any noused variable errors // times/time_arith.yaml line #12 // t4 = r.epoch_time(rt4) suite.T().Log("Possibly executing: var t4 r.Term = r.EpochTime(rt4)") t4 := r.EpochTime(rt4) _ = t4 // Prevent any noused variable errors // times/time_arith.yaml line #13 // ts = r.expr([t1, t2, t3, t4]) suite.T().Log("Possibly executing: var ts r.Term = r.Expr([]interface{}{t1, t2, t3, t4})") ts := r.Expr([]interface{}{t1, t2, t3, t4}) _ = ts // Prevent any noused variable errors { // times/time_arith.yaml line #17 /* true */ var expected_ bool = true /* ((t2 - t1) * 1000).do(lambda x:(x > 0.99) & (x < 1.01)) */ suite.T().Log("About to run line #17: r.Sub(t2, t1).Mul(1000).Do(func(x r.Term) interface{} { return r.Gt(x, 0.99).And(r.Lt(x, 1.01))})") runAndAssert(suite.Suite, expected_, r.Sub(t2, t1).Mul(1000).Do(func(x r.Term) interface{} { return r.Gt(x, 0.99).And(r.Lt(x, 1.01)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // times/time_arith.yaml line #20 /* 1 */ var expected_ int = 1 /* t3 - t1 */ suite.T().Log("About to run line #20: r.Sub(t3, t1)") runAndAssert(suite.Suite, expected_, r.Sub(t3, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // times/time_arith.yaml line #23 /* 1000000000 */ var expected_ int = 1000000000 /* t4 - t1 */ suite.T().Log("About to run line #23: r.Sub(t4, t1)") runAndAssert(suite.Suite, expected_, r.Sub(t4, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // times/time_arith.yaml line #28 /* true */ var expected_ bool = true /* ((t1 - t2) * 1000).do(lambda x:(x < -0.99) & (x > -1.01)) */ suite.T().Log("About to run line #28: r.Sub(t1, t2).Mul(1000).Do(func(x r.Term) interface{} { return r.Lt(x, -0.99).And(r.Gt(x, -1.01))})") runAndAssert(suite.Suite, expected_, r.Sub(t1, t2).Mul(1000).Do(func(x r.Term) interface{} { return r.Lt(x, -0.99).And(r.Gt(x, -1.01)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // times/time_arith.yaml line #31 /* -1 */ var expected_ int = -1 /* t1 - t3 */ suite.T().Log("About to run line #31: r.Sub(t1, t3)") runAndAssert(suite.Suite, expected_, r.Sub(t1, t3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // times/time_arith.yaml line #34 /* -1000000000 */ var expected_ int = -1000000000 /* t1 - t4 */ suite.T().Log("About to run line #34: r.Sub(t1, t4)") runAndAssert(suite.Suite, expected_, r.Sub(t1, t4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // times/time_arith.yaml line #39 /* ([rt1, rt2, rt3, rt4]) */ var expected_ []interface{} = []interface{}{rt1, rt2, rt3, rt4} /* ts.map(lambda x:t1 + (x - t1)).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #39: ts.Map(func(x r.Term) interface{} { return r.Add(t1, r.Sub(x, t1))}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Add(t1, r.Sub(x, t1)) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // times/time_arith.yaml line #43 /* err("ReqlQueryLogicError", "Expected type NUMBER but found PTYPE<TIME>.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found PTYPE<TIME>.") /* ts.map(lambda x:(t1 + x) - t1).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #43: ts.Map(func(x r.Term) interface{} { return r.Add(t1, x).Sub(t1)}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Add(t1, x).Sub(t1) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // times/time_arith.yaml line #47 /* ([rt1, rt2, rt3, rt4]) */ var expected_ []interface{} = []interface{}{rt1, rt2, rt3, rt4} /* ts.map(lambda x:t1 - (t1 - x)).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #47: ts.Map(func(x r.Term) interface{} { return r.Sub(t1, r.Sub(t1, x))}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Sub(t1, r.Sub(t1, x)) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // times/time_arith.yaml line #52 /* ([[[false, true, true, false, true, false], [true, true, false, true, false, false], [true, true, false, true, false, false], [true, true, false, true, false, false]], [[false, false, false, true, true, true], [false, true, true, false, true, false], [true, true, false, true, false, false], [true, true, false, true, false, false]], [[false, false, false, true, true, true], [false, false, false, true, true, true], [false, true, true, false, true, false], [true, true, false, true, false, false]], [[false, false, false, true, true, true], [false, false, false, true, true, true], [false, false, false, true, true, true], [false, true, true, false, true, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, true, true, false, true, false}, []interface{}{true, true, false, true, false, false}, []interface{}{true, true, false, true, false, false}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{false, true, true, false, true, false}, []interface{}{true, true, false, true, false, false}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{false, false, false, true, true, true}, []interface{}{false, true, true, false, true, false}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{false, false, false, true, true, true}, []interface{}{false, false, false, true, true, true}, []interface{}{false, true, true, false, true, false}}} /* ts.map(lambda x:ts.map(lambda y:[x < y, x <= y, x == y, x != y, x >= y, x > y])) */ suite.T().Log("About to run line #52: ts.Map(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return []interface{}{r.Lt(x, y), r.Le(x, y), r.Eq(x, y), r.Ne(x, y), r.Ge(x, y), r.Gt(x, y)}})})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return []interface{}{r.Lt(x, y), r.Le(x, y), r.Eq(x, y), r.Ne(x, y), r.Ge(x, y), r.Gt(x, y)} }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } // times/time_arith.yaml line #73 // datum_types = r.expr([null, true, false, 1, "1", [1], {"1":1}, r.binary(b'')]) suite.T().Log("Possibly executing: var datum_types r.Term = r.Expr([]interface{}{nil, true, false, 1, '1', []interface{}{1}, map[interface{}]interface{}{'1': 1, }, r.Binary([]byte{})})") datum_types := r.Expr([]interface{}{nil, true, false, 1, "1", []interface{}{1}, map[interface{}]interface{}{"1": 1}, r.Binary([]byte{})}) _ = datum_types // Prevent any noused variable errors { // times/time_arith.yaml line #79 /* ([[[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[false, false, false, true, true, true], [true, true, false, true, false, false]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}} /* datum_types.map(lambda x:r.expr([[x, t1], [t1, x]]).map(lambda xy:xy[0].do(lambda x2:xy[1].do(lambda y:[x2 < y, x2 <= y, x2 == y, x2 != y, x2 >= y, x2 > y])))) */ suite.T().Log("About to run line #79: datum_types.Map(func(x r.Term) interface{} { return r.Expr([]interface{}{[]interface{}{x, t1}, []interface{}{t1, x}}).Map(func(xy r.Term) interface{} { return xy.AtIndex(0).Do(func(x2 r.Term) interface{} { return xy.AtIndex(1).Do(func(y r.Term) interface{} { return []interface{}{r.Lt(x2, y), r.Le(x2, y), r.Eq(x2, y), r.Ne(x2, y), r.Ge(x2, y), r.Gt(x2, y)}})})})})") runAndAssert(suite.Suite, expected_, datum_types.Map(func(x r.Term) interface{} { return r.Expr([]interface{}{[]interface{}{x, t1}, []interface{}{t1, x}}).Map(func(xy r.Term) interface{} { return xy.AtIndex(0).Do(func(x2 r.Term) interface{} { return xy.AtIndex(1).Do(func(y r.Term) interface{} { return []interface{}{r.Lt(x2, y), r.Le(x2, y), r.Eq(x2, y), r.Ne(x2, y), r.Ge(x2, y), r.Gt(x2, y)} }) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #79") } { // times/time_arith.yaml line #99 /* ([[[false, true, true, true], [false, false, true, true], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, true, true], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c)))) */ suite.T().Log("About to run line #99: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c)})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // times/time_arith.yaml line #119 /* ([[[false, false, false, false], [false, false, true, true], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c, left_bound='open')))) */ suite.T().Log("About to run line #119: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: 'open', })})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: "open"}) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #119") } { // times/time_arith.yaml line #139 /* ([[[true, true, true, true], [false, true, true, true], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, true, true, true], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, true]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{true, true, true, true}, []interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c, right_bound='closed')))) */ suite.T().Log("About to run line #139: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{RightBound: 'closed', })})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{RightBound: "closed"}) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #139") } { // times/time_arith.yaml line #159 /* ([[[false, false, false, false], [false, true, true, true], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, false, false, false}, []interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c, left_bound='open', right_bound='closed')))) */ suite.T().Log("About to run line #159: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: 'open', RightBound: 'closed', })})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: "open", RightBound: "closed"}) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // times/time_arith.yaml line #179 /* rts */ var expected_ []interface{} = rts /* ts.map(lambda x:x.date() + x.time_of_day()).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #179: ts.Map(func(x r.Term) interface{} { return x.Date().Add(x.TimeOfDay())}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return x.Date().Add(x.TimeOfDay()) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #179") } { // times/time_arith.yaml line #185 /* rt1 */ var expected_ float64 = rt1 /* r.epoch_time(rt1).do(r.js("(function(data){return data})")).to_epoch_time() */ suite.T().Log("About to run line #185: r.EpochTime(rt1).Do(r.JS('(function(data){return data})')).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.EpochTime(rt1).Do(r.JS("(function(data){return data})")).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #185") } { // times/time_arith.yaml line #190 /* ("2012-08-01T00:00:00+00:00") */ var expected_ string = "2012-08-01T00:00:00+00:00" /* r.do(r.js("new Date('2012-08-01')")).to_iso8601() */ suite.T().Log("About to run line #190: r.Do(r.JS('new Date('2012-08-01')')).ToISO8601()") runAndAssert(suite.Suite, expected_, r.Do(r.JS("new Date('2012-08-01')")).ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #190") } { // times/time_arith.yaml line #195 /* ("2012-08-01T00:00:00+00:00") */ var expected_ string = "2012-08-01T00:00:00+00:00" /* r.do(r.js("(function(x){doc = new Object(); doc.date = new Date('2012-08-01'); return doc;})"))["date"].to_iso8601() */ suite.T().Log("About to run line #195: r.Do(r.JS('(function(x){doc = new Object(); doc.date = new Date('2012-08-01'); return doc;})')).AtIndex('date').ToISO8601()") runAndAssert(suite.Suite, expected_, r.Do(r.JS("(function(x){doc = new Object(); doc.date = new Date('2012-08-01'); return doc;})")).AtIndex("date").ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #195") } }
func (suite *GeoIntersectionInclusionSuite) TestCases() { suite.T().Log("Running GeoIntersectionInclusionSuite: Test intersects and includes semantics") { // geo/intersection_inclusion.yaml line #4 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.point(1.5,1.5)) */ suite.T().Log("About to run line #4: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(1.5, 1.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(1.5, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } { // geo/intersection_inclusion.yaml line #6 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.point(2.5,2.5)) */ suite.T().Log("About to run line #6: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(2.5, 2.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(2.5, 2.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // geo/intersection_inclusion.yaml line #8 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).intersects(r.point(1.5,1.5)) */ suite.T().Log("About to run line #8: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.5, 1.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.5, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // geo/intersection_inclusion.yaml line #10 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).intersects(r.point(1.05,1.05)) */ suite.T().Log("About to run line #10: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.05, 1.05))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.05, 1.05)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // geo/intersection_inclusion.yaml line #13 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.point(2,2)) */ suite.T().Log("About to run line #13: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(2, 2))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(2, 2)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // geo/intersection_inclusion.yaml line #15 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.point(2,1.5)) */ suite.T().Log("About to run line #15: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(2, 1.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Point(2, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // geo/intersection_inclusion.yaml line #17 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.line([1.5,1.5], [2,2])) */ suite.T().Log("About to run line #17: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 2}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 2})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // geo/intersection_inclusion.yaml line #19 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.line([1.5,1.5], [2,1.5])) */ suite.T().Log("About to run line #19: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 1.5}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 1.5})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // geo/intersection_inclusion.yaml line #22 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).intersects(r.point(1.1,1.1)) */ suite.T().Log("About to run line #22: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.1, 1.1))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.1, 1.1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // geo/intersection_inclusion.yaml line #24 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).intersects(r.point(1.5,1.1)) */ suite.T().Log("About to run line #24: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.5, 1.1))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Point(1.5, 1.1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // geo/intersection_inclusion.yaml line #27 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.line([2,2], [3,3])) */ suite.T().Log("About to run line #27: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{2, 2}, []interface{}{3, 3}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{2, 2}, []interface{}{3, 3})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // geo/intersection_inclusion.yaml line #29 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.line([2,1.5], [3,3])) */ suite.T().Log("About to run line #29: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{2, 1.5}, []interface{}{3, 3}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{2, 1.5}, []interface{}{3, 3})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // geo/intersection_inclusion.yaml line #31 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.line([1.5,1.5], [3,3])) */ suite.T().Log("About to run line #31: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{1.5, 1.5}, []interface{}{3, 3}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Line([]interface{}{1.5, 1.5}, []interface{}{3, 3})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // geo/intersection_inclusion.yaml line #33 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.polygon([1.2,1.2], [1.8,1.2], [1.8,1.8], [1.2,1.8])) */ suite.T().Log("About to run line #33: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #33") } { // geo/intersection_inclusion.yaml line #35 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.polygon([1.5,1.5], [2.5,1.5], [2.5,2.5], [1.5,2.5])) */ suite.T().Log("About to run line #35: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{1.5, 1.5}, []interface{}{2.5, 1.5}, []interface{}{2.5, 2.5}, []interface{}{1.5, 2.5}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{1.5, 1.5}, []interface{}{2.5, 1.5}, []interface{}{2.5, 2.5}, []interface{}{1.5, 2.5})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // geo/intersection_inclusion.yaml line #37 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).intersects(r.polygon([1.2,1.2], [1.8,1.2], [1.8,1.8], [1.2,1.8])) */ suite.T().Log("About to run line #37: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // geo/intersection_inclusion.yaml line #39 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).intersects(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])) */ suite.T().Log("About to run line #39: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Intersects(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // geo/intersection_inclusion.yaml line #42 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.polygon([2,1.1], [3,1.1], [3,1.9], [2,1.9])) */ suite.T().Log("About to run line #42: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{2, 1.1}, []interface{}{3, 1.1}, []interface{}{3, 1.9}, []interface{}{2, 1.9}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{2, 1.1}, []interface{}{3, 1.1}, []interface{}{3, 1.9}, []interface{}{2, 1.9})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // geo/intersection_inclusion.yaml line #44 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).intersects(r.polygon([2,2], [3,2], [3,3], [2,3])) */ suite.T().Log("About to run line #44: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{2, 2}, []interface{}{3, 2}, []interface{}{3, 3}, []interface{}{2, 3}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Intersects(r.Polygon([]interface{}{2, 2}, []interface{}{3, 2}, []interface{}{3, 3}, []interface{}{2, 3})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // geo/intersection_inclusion.yaml line #46 /* false */ var expected_ bool = false /* r.point(1,1).intersects(r.point(1.5,1.5)) */ suite.T().Log("About to run line #46: r.Point(1, 1).Intersects(r.Point(1.5, 1.5))") runAndAssert(suite.Suite, expected_, r.Point(1, 1).Intersects(r.Point(1.5, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // geo/intersection_inclusion.yaml line #48 /* true */ var expected_ bool = true /* r.point(1,1).intersects(r.point(1,1)) */ suite.T().Log("About to run line #48: r.Point(1, 1).Intersects(r.Point(1, 1))") runAndAssert(suite.Suite, expected_, r.Point(1, 1).Intersects(r.Point(1, 1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } { // geo/intersection_inclusion.yaml line #50 /* true */ var expected_ bool = true /* r.line([1,1], [2,1]).intersects(r.point(1,1)) */ suite.T().Log("About to run line #50: r.Line([]interface{}{1, 1}, []interface{}{2, 1}).Intersects(r.Point(1, 1))") runAndAssert(suite.Suite, expected_, r.Line([]interface{}{1, 1}, []interface{}{2, 1}).Intersects(r.Point(1, 1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // geo/intersection_inclusion.yaml line #55 /* true */ var expected_ bool = true /* r.line([1,1], [1,2]).intersects(r.point(1,1.8)) */ suite.T().Log("About to run line #55: r.Line([]interface{}{1, 1}, []interface{}{1, 2}).Intersects(r.Point(1, 1.8))") runAndAssert(suite.Suite, expected_, r.Line([]interface{}{1, 1}, []interface{}{1, 2}).Intersects(r.Point(1, 1.8)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // geo/intersection_inclusion.yaml line #57 /* true */ var expected_ bool = true /* r.line([1,0], [2,0]).intersects(r.point(1.8,0)) */ suite.T().Log("About to run line #57: r.Line([]interface{}{1, 0}, []interface{}{2, 0}).Intersects(r.Point(1.8, 0))") runAndAssert(suite.Suite, expected_, r.Line([]interface{}{1, 0}, []interface{}{2, 0}).Intersects(r.Point(1.8, 0)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // geo/intersection_inclusion.yaml line #59 /* false */ var expected_ bool = false /* r.line([1,1], [2,1]).intersects(r.point(1.5,1.5)) */ suite.T().Log("About to run line #59: r.Line([]interface{}{1, 1}, []interface{}{2, 1}).Intersects(r.Point(1.5, 1.5))") runAndAssert(suite.Suite, expected_, r.Line([]interface{}{1, 1}, []interface{}{2, 1}).Intersects(r.Point(1.5, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // geo/intersection_inclusion.yaml line #61 /* true */ var expected_ bool = true /* r.line([1,1], [2,1]).intersects(r.line([2,1], [3,1])) */ suite.T().Log("About to run line #61: r.Line([]interface{}{1, 1}, []interface{}{2, 1}).Intersects(r.Line([]interface{}{2, 1}, []interface{}{3, 1}))") runAndAssert(suite.Suite, expected_, r.Line([]interface{}{1, 1}, []interface{}{2, 1}).Intersects(r.Line([]interface{}{2, 1}, []interface{}{3, 1})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #61") } { // geo/intersection_inclusion.yaml line #64 /* 2 */ var expected_ int = 2 /* r.expr([r.point(1, 0), r.point(3,0), r.point(2, 0)]).intersects(r.line([0,0], [2, 0])).count() */ suite.T().Log("About to run line #64: r.Expr([]interface{}{r.Point(1, 0), r.Point(3, 0), r.Point(2, 0)}).Intersects(r.Line([]interface{}{0, 0}, []interface{}{2, 0})).Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Point(1, 0), r.Point(3, 0), r.Point(2, 0)}).Intersects(r.Line([]interface{}{0, 0}, []interface{}{2, 0})).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #64") } { // geo/intersection_inclusion.yaml line #68 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.point(1.5,1.5)) */ suite.T().Log("About to run line #68: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(1.5, 1.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(1.5, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // geo/intersection_inclusion.yaml line #70 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.point(2.5,2.5)) */ suite.T().Log("About to run line #70: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(2.5, 2.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(2.5, 2.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // geo/intersection_inclusion.yaml line #72 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).includes(r.point(1.5,1.5)) */ suite.T().Log("About to run line #72: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.5, 1.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.5, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #72") } { // geo/intersection_inclusion.yaml line #74 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).includes(r.point(1.05,1.05)) */ suite.T().Log("About to run line #74: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.05, 1.05))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.05, 1.05)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // geo/intersection_inclusion.yaml line #76 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.point(2,2)) */ suite.T().Log("About to run line #76: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(2, 2))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(2, 2)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #76") } { // geo/intersection_inclusion.yaml line #78 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.point(2,1.5)) */ suite.T().Log("About to run line #78: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(2, 1.5))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Point(2, 1.5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // geo/intersection_inclusion.yaml line #80 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.line([1.5,1.5], [2,2])) */ suite.T().Log("About to run line #80: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 2}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 2})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #80") } { // geo/intersection_inclusion.yaml line #82 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.line([1.5,1.5], [2,1.5])) */ suite.T().Log("About to run line #82: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 1.5}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{1.5, 1.5}, []interface{}{2, 1.5})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #82") } { // geo/intersection_inclusion.yaml line #84 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).includes(r.point(1.1,1.1)) */ suite.T().Log("About to run line #84: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.1, 1.1))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.1, 1.1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #84") } { // geo/intersection_inclusion.yaml line #86 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).includes(r.point(1.5,1.1)) */ suite.T().Log("About to run line #86: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.5, 1.1))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Point(1.5, 1.1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // geo/intersection_inclusion.yaml line #88 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.line([2,2], [3,3])) */ suite.T().Log("About to run line #88: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{2, 2}, []interface{}{3, 3}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{2, 2}, []interface{}{3, 3})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #88") } { // geo/intersection_inclusion.yaml line #90 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.line([2,1.5], [2,2])) */ suite.T().Log("About to run line #90: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{2, 1.5}, []interface{}{2, 2}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{2, 1.5}, []interface{}{2, 2})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #90") } { // geo/intersection_inclusion.yaml line #92 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.line([2,1], [2,2])) */ suite.T().Log("About to run line #92: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{2, 1}, []interface{}{2, 2}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{2, 1}, []interface{}{2, 2})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } { // geo/intersection_inclusion.yaml line #94 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.line([1.5,1.5], [3,3])) */ suite.T().Log("About to run line #94: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{1.5, 1.5}, []interface{}{3, 3}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Line([]interface{}{1.5, 1.5}, []interface{}{3, 3})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #94") } { // geo/intersection_inclusion.yaml line #96 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.polygon([1,1], [2,1], [2,2], [1,2])) */ suite.T().Log("About to run line #96: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #96") } { // geo/intersection_inclusion.yaml line #98 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.polygon([1.2,1.2], [1.8,1.2], [1.8,1.8], [1.2,1.8])) */ suite.T().Log("About to run line #98: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #98") } { // geo/intersection_inclusion.yaml line #100 /* true */ var expected_ bool = true /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.polygon([1.5,1.5], [2,1.5], [2,2], [1.5,2])) */ suite.T().Log("About to run line #100: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1.5, 1.5}, []interface{}{2, 1.5}, []interface{}{2, 2}, []interface{}{1.5, 2}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1.5, 1.5}, []interface{}{2, 1.5}, []interface{}{2, 2}, []interface{}{1.5, 2})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #100") } { // geo/intersection_inclusion.yaml line #102 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.polygon([1.5,1.5], [2.5,1.5], [2.5,2.5], [1.5,2.5])) */ suite.T().Log("About to run line #102: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1.5, 1.5}, []interface{}{2.5, 1.5}, []interface{}{2.5, 2.5}, []interface{}{1.5, 2.5}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{1.5, 1.5}, []interface{}{2.5, 1.5}, []interface{}{2.5, 2.5}, []interface{}{1.5, 2.5})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #102") } { // geo/intersection_inclusion.yaml line #104 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).includes(r.polygon([1.2,1.2], [1.8,1.2], [1.8,1.8], [1.2,1.8])) */ suite.T().Log("About to run line #104: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Polygon([]interface{}{1.2, 1.2}, []interface{}{1.8, 1.2}, []interface{}{1.8, 1.8}, []interface{}{1.2, 1.8})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #104") } { // geo/intersection_inclusion.yaml line #106 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).polygon_sub(r.polygon([1.1,1.1], [1.9,1.1], [1.9,1.9], [1.1,1.9])).includes(r.polygon([1.1,1.1], [2,1.1], [2,2], [1.1,2])) */ suite.T().Log("About to run line #106: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{2, 1.1}, []interface{}{2, 2}, []interface{}{1.1, 2}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).PolygonSub(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{1.9, 1.1}, []interface{}{1.9, 1.9}, []interface{}{1.1, 1.9})).Includes(r.Polygon([]interface{}{1.1, 1.1}, []interface{}{2, 1.1}, []interface{}{2, 2}, []interface{}{1.1, 2})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #106") } { // geo/intersection_inclusion.yaml line #108 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.polygon([2,1.1], [3,1.1], [3,1.9], [2,1.9])) */ suite.T().Log("About to run line #108: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{2, 1.1}, []interface{}{3, 1.1}, []interface{}{3, 1.9}, []interface{}{2, 1.9}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{2, 1.1}, []interface{}{3, 1.1}, []interface{}{3, 1.9}, []interface{}{2, 1.9})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // geo/intersection_inclusion.yaml line #110 /* false */ var expected_ bool = false /* r.polygon([1,1], [2,1], [2,2], [1,2]).includes(r.polygon([2,2], [3,2], [3,3], [2,3])) */ suite.T().Log("About to run line #110: r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{2, 2}, []interface{}{3, 2}, []interface{}{3, 3}, []interface{}{2, 3}))") runAndAssert(suite.Suite, expected_, r.Polygon([]interface{}{1, 1}, []interface{}{2, 1}, []interface{}{2, 2}, []interface{}{1, 2}).Includes(r.Polygon([]interface{}{2, 2}, []interface{}{3, 2}, []interface{}{3, 3}, []interface{}{2, 3})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #110") } { // geo/intersection_inclusion.yaml line #113 /* 1 */ var expected_ int = 1 /* r.expr([r.polygon([0,0], [1,1], [1,0]), r.polygon([0,1], [1,2], [1,1])]).includes(r.point(0,0)).count() */ suite.T().Log("About to run line #113: r.Expr([]interface{}{r.Polygon([]interface{}{0, 0}, []interface{}{1, 1}, []interface{}{1, 0}), r.Polygon([]interface{}{0, 1}, []interface{}{1, 2}, []interface{}{1, 1})}).Includes(r.Point(0, 0)).Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Polygon([]interface{}{0, 0}, []interface{}{1, 1}, []interface{}{1, 0}), r.Polygon([]interface{}{0, 1}, []interface{}{1, 2}, []interface{}{1, 1})}).Includes(r.Point(0, 0)).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // geo/intersection_inclusion.yaml line #116 /* err('ReqlQueryLogicError', 'Expected geometry of type `Polygon` but found `Point`.') */ var expected_ Err = err("ReqlQueryLogicError", "Expected geometry of type `Polygon` but found `Point`.") /* r.point(0,0).includes(r.point(0,0)) */ suite.T().Log("About to run line #116: r.Point(0, 0).Includes(r.Point(0, 0))") runAndAssert(suite.Suite, expected_, r.Point(0, 0).Includes(r.Point(0, 0)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #116") } { // geo/intersection_inclusion.yaml line #118 /* err('ReqlQueryLogicError', 'Expected geometry of type `Polygon` but found `LineString`.') */ var expected_ Err = err("ReqlQueryLogicError", "Expected geometry of type `Polygon` but found `LineString`.") /* r.line([0,0], [0,1]).includes(r.point(0,0)) */ suite.T().Log("About to run line #118: r.Line([]interface{}{0, 0}, []interface{}{0, 1}).Includes(r.Point(0, 0))") runAndAssert(suite.Suite, expected_, r.Line([]interface{}{0, 0}, []interface{}{0, 1}).Includes(r.Point(0, 0)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #118") } }
func (suite *DatumBoolSuite) TestCases() { suite.T().Log("Running DatumBoolSuite: Tests of conversion to and from the RQL bool type") { // datum/bool.yaml line #3 /* true */ var expected_ bool = true /* r.expr(True) */ suite.T().Log("About to run line #3: r.Expr(true)") runAndAssert(suite.Suite, expected_, r.Expr(true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #3") } { // datum/bool.yaml line #10 /* false */ var expected_ bool = false /* r.expr(False) */ suite.T().Log("About to run line #10: r.Expr(false)") runAndAssert(suite.Suite, expected_, r.Expr(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // datum/bool.yaml line #17 /* 'BOOL' */ var expected_ string = "BOOL" /* r.expr(False).type_of() */ suite.T().Log("About to run line #17: r.Expr(false).TypeOf()") runAndAssert(suite.Suite, expected_, r.Expr(false).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // datum/bool.yaml line #21 /* 'true' */ var expected_ string = "true" /* r.expr(True).coerce_to('string') */ suite.T().Log("About to run line #21: r.Expr(true).CoerceTo('string')") runAndAssert(suite.Suite, expected_, r.Expr(true).CoerceTo("string"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // datum/bool.yaml line #24 /* True */ var expected_ bool = true /* r.expr(True).coerce_to('bool') */ suite.T().Log("About to run line #24: r.Expr(true).CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr(true).CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // datum/bool.yaml line #27 /* False */ var expected_ bool = false /* r.expr(False).coerce_to('bool') */ suite.T().Log("About to run line #27: r.Expr(false).CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr(false).CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // datum/bool.yaml line #30 /* False */ var expected_ bool = false /* r.expr(null).coerce_to('bool') */ suite.T().Log("About to run line #30: r.Expr(nil).CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr(nil).CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // datum/bool.yaml line #33 /* True */ var expected_ bool = true /* r.expr(0).coerce_to('bool') */ suite.T().Log("About to run line #33: r.Expr(0).CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr(0).CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #33") } { // datum/bool.yaml line #36 /* True */ var expected_ bool = true /* r.expr('false').coerce_to('bool') */ suite.T().Log("About to run line #36: r.Expr('false').CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr("false").CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // datum/bool.yaml line #39 /* True */ var expected_ bool = true /* r.expr('foo').coerce_to('bool') */ suite.T().Log("About to run line #39: r.Expr('foo').CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr("foo").CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // datum/bool.yaml line #42 /* True */ var expected_ bool = true /* r.expr([]).coerce_to('bool') */ suite.T().Log("About to run line #42: r.Expr([]interface{}{}).CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // datum/bool.yaml line #45 /* True */ var expected_ bool = true /* r.expr({}).coerce_to('bool') */ suite.T().Log("About to run line #45: r.Expr(map[interface{}]interface{}{}).CoerceTo('bool')") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).CoerceTo("bool"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #45") } }
func (suite *TransformArraySuite) TestCases() { suite.T().Log("Running TransformArraySuite: Tests manipulation operations on arrays") // transform/array.yaml line #5 // arr = r.expr([1, 2, 3]) suite.T().Log("Possibly executing: var arr r.Term = r.Expr([]interface{}{1, 2, 3})") arr := r.Expr([]interface{}{1, 2, 3}) _ = arr // Prevent any noused variable errors // transform/array.yaml line #6 // dupe_arr = r.expr([1, 1, 2, 3]) suite.T().Log("Possibly executing: var dupe_arr r.Term = r.Expr([]interface{}{1, 1, 2, 3})") dupe_arr := r.Expr([]interface{}{1, 1, 2, 3}) _ = dupe_arr // Prevent any noused variable errors // transform/array.yaml line #7 // objArr = r.expr([{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}]) suite.T().Log("Possibly executing: var objArr r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 'a', }, map[interface{}]interface{}{'a': 2, 'b': 'b', }, map[interface{}]interface{}{'a': 3, 'b': 'c', }})") objArr := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}}) _ = objArr // Prevent any noused variable errors // transform/array.yaml line #8 // nestedObjArr = r.expr([{'a':1, 'b':{'c':1}}, {'a':2, 'b':{'c':2}}, {'a':3, 'b':{'c':3}}]) suite.T().Log("Possibly executing: var nestedObjArr r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': map[interface{}]interface{}{'c': 1, }, }, map[interface{}]interface{}{'a': 2, 'b': map[interface{}]interface{}{'c': 2, }, }, map[interface{}]interface{}{'a': 3, 'b': map[interface{}]interface{}{'c': 3, }, }})") nestedObjArr := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": map[interface{}]interface{}{"c": 1}}, map[interface{}]interface{}{"a": 2, "b": map[interface{}]interface{}{"c": 2}}, map[interface{}]interface{}{"a": 3, "b": map[interface{}]interface{}{"c": 3}}}) _ = nestedObjArr // Prevent any noused variable errors { // transform/array.yaml line #12 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* arr.append(4) */ suite.T().Log("About to run line #12: arr.Append(4)") runAndAssert(suite.Suite, expected_, arr.Append(4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // transform/array.yaml line #14 /* [1,2,3,'a'] */ var expected_ []interface{} = []interface{}{1, 2, 3, "a"} /* arr.append('a') */ suite.T().Log("About to run line #14: arr.Append('a')") runAndAssert(suite.Suite, expected_, arr.Append("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // transform/array.yaml line #19 /* [0,1,2,3] */ var expected_ []interface{} = []interface{}{0, 1, 2, 3} /* arr.prepend(0) */ suite.T().Log("About to run line #19: arr.Prepend(0)") runAndAssert(suite.Suite, expected_, arr.Prepend(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // transform/array.yaml line #21 /* ['a',1,2,3] */ var expected_ []interface{} = []interface{}{"a", 1, 2, 3} /* arr.prepend('a') */ suite.T().Log("About to run line #21: arr.Prepend('a')") runAndAssert(suite.Suite, expected_, arr.Prepend("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // transform/array.yaml line #26 /* [3] */ var expected_ []interface{} = []interface{}{3} /* arr.difference([1,2,2]) */ suite.T().Log("About to run line #26: arr.Difference([]interface{}{1, 2, 2})") runAndAssert(suite.Suite, expected_, arr.Difference([]interface{}{1, 2, 2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // transform/array.yaml line #28 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* arr.difference([]) */ suite.T().Log("About to run line #28: arr.Difference([]interface{}{})") runAndAssert(suite.Suite, expected_, arr.Difference([]interface{}{}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // transform/array.yaml line #30 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* arr.difference(["foo", "bar"]) */ suite.T().Log("About to run line #30: arr.Difference([]interface{}{'foo', 'bar'})") runAndAssert(suite.Suite, expected_, arr.Difference([]interface{}{"foo", "bar"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // transform/array.yaml line #34 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* dupe_arr.set_insert(1) */ suite.T().Log("About to run line #34: dupe_arr.SetInsert(1)") runAndAssert(suite.Suite, expected_, dupe_arr.SetInsert(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // transform/array.yaml line #36 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* dupe_arr.set_insert(4) */ suite.T().Log("About to run line #36: dupe_arr.SetInsert(4)") runAndAssert(suite.Suite, expected_, dupe_arr.SetInsert(4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // transform/array.yaml line #39 /* [1,2,3,4,5] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4, 5} /* dupe_arr.set_union([3,4,5,5]) */ suite.T().Log("About to run line #39: dupe_arr.SetUnion([]interface{}{3, 4, 5, 5})") runAndAssert(suite.Suite, expected_, dupe_arr.SetUnion([]interface{}{3, 4, 5, 5}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // transform/array.yaml line #41 /* [1,2,3,5,6] */ var expected_ []interface{} = []interface{}{1, 2, 3, 5, 6} /* dupe_arr.set_union([5,6]) */ suite.T().Log("About to run line #41: dupe_arr.SetUnion([]interface{}{5, 6})") runAndAssert(suite.Suite, expected_, dupe_arr.SetUnion([]interface{}{5, 6}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #41") } { // transform/array.yaml line #44 /* [1,2] */ var expected_ []interface{} = []interface{}{1, 2} /* dupe_arr.set_intersection([1,1,1,2,2]) */ suite.T().Log("About to run line #44: dupe_arr.SetIntersection([]interface{}{1, 1, 1, 2, 2})") runAndAssert(suite.Suite, expected_, dupe_arr.SetIntersection([]interface{}{1, 1, 1, 2, 2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // transform/array.yaml line #46 /* [] */ var expected_ []interface{} = []interface{}{} /* dupe_arr.set_intersection(["foo"]) */ suite.T().Log("About to run line #46: dupe_arr.SetIntersection([]interface{}{'foo'})") runAndAssert(suite.Suite, expected_, dupe_arr.SetIntersection([]interface{}{"foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // transform/array.yaml line #49 /* [2,3] */ var expected_ []interface{} = []interface{}{2, 3} /* dupe_arr.set_difference([1,1,1,10]) */ suite.T().Log("About to run line #49: dupe_arr.SetDifference([]interface{}{1, 1, 1, 10})") runAndAssert(suite.Suite, expected_, dupe_arr.SetDifference([]interface{}{1, 1, 1, 10}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // transform/array.yaml line #51 /* [1,3] */ var expected_ []interface{} = []interface{}{1, 3} /* dupe_arr.set_difference([2]) */ suite.T().Log("About to run line #51: dupe_arr.SetDifference([]interface{}{2})") runAndAssert(suite.Suite, expected_, dupe_arr.SetDifference([]interface{}{2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // transform/array.yaml line #58 /* [2, 3] */ var expected_ []interface{} = []interface{}{2, 3} /* arr[1:3] */ suite.T().Log("About to run line #58: arr.Slice(1, 3)") runAndAssert(suite.Suite, expected_, arr.Slice(1, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // transform/array.yaml line #59 /* [2, 3] */ var expected_ []interface{} = []interface{}{2, 3} /* arr.slice(1, 3) */ suite.T().Log("About to run line #59: arr.Slice(1, 3)") runAndAssert(suite.Suite, expected_, arr.Slice(1, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // transform/array.yaml line #60 /* [2, 3] */ var expected_ []interface{} = []interface{}{2, 3} /* arr.slice(1, 2, right_bound='closed') */ suite.T().Log("About to run line #60: arr.Slice(1, 2).OptArgs(r.SliceOpts{RightBound: 'closed', })") runAndAssert(suite.Suite, expected_, arr.Slice(1, 2).OptArgs(r.SliceOpts{RightBound: "closed"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // transform/array.yaml line #72 /* [1,2] */ var expected_ []interface{} = []interface{}{1, 2} /* arr[:2] */ suite.T().Log("About to run line #72: arr.Slice(0, 2)") runAndAssert(suite.Suite, expected_, arr.Slice(0, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #72") } { // transform/array.yaml line #73 /* [1,2] */ var expected_ []interface{} = []interface{}{1, 2} /* arr.slice(0,2) */ suite.T().Log("About to run line #73: arr.Slice(0, 2)") runAndAssert(suite.Suite, expected_, arr.Slice(0, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // transform/array.yaml line #81 /* [2,3] */ var expected_ []interface{} = []interface{}{2, 3} /* arr[1:] */ suite.T().Log("About to run line #81: arr.Slice(1, -1, r.SliceOpts{RightBound: 'closed'})") runAndAssert(suite.Suite, expected_, arr.Slice(1, -1, r.SliceOpts{RightBound: "closed"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // transform/array.yaml line #82 /* [2,3] */ var expected_ []interface{} = []interface{}{2, 3} /* arr.slice(1) */ suite.T().Log("About to run line #82: arr.Slice(1)") runAndAssert(suite.Suite, expected_, arr.Slice(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #82") } { // transform/array.yaml line #89 /* [2] */ var expected_ []interface{} = []interface{}{2} /* arr.slice(-2, -1) */ suite.T().Log("About to run line #89: arr.Slice(-2, -1)") runAndAssert(suite.Suite, expected_, arr.Slice(-2, -1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // transform/array.yaml line #95 /* [2,3] */ var expected_ []interface{} = []interface{}{2, 3} /* arr.skip(1) */ suite.T().Log("About to run line #95: arr.Skip(1)") runAndAssert(suite.Suite, expected_, arr.Skip(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // transform/array.yaml line #97 /* [3] */ var expected_ []interface{} = []interface{}{3} /* arr.skip(2) */ suite.T().Log("About to run line #97: arr.Skip(2)") runAndAssert(suite.Suite, expected_, arr.Skip(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #97") } { // transform/array.yaml line #99 /* [] */ var expected_ []interface{} = []interface{}{} /* arr.skip(12) */ suite.T().Log("About to run line #99: arr.Skip(12)") runAndAssert(suite.Suite, expected_, arr.Skip(12), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // transform/array.yaml line #104 /* [1,2] */ var expected_ []interface{} = []interface{}{1, 2} /* arr.limit(2) */ suite.T().Log("About to run line #104: arr.Limit(2)") runAndAssert(suite.Suite, expected_, arr.Limit(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #104") } { // transform/array.yaml line #106 /* [] */ var expected_ []interface{} = []interface{}{} /* arr.limit(0) */ suite.T().Log("About to run line #106: arr.Limit(0)") runAndAssert(suite.Suite, expected_, arr.Limit(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #106") } { // transform/array.yaml line #108 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* arr.limit(12) */ suite.T().Log("About to run line #108: arr.Limit(12)") runAndAssert(suite.Suite, expected_, arr.Limit(12), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // transform/array.yaml line #113 /* [{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}} /* objArr.pluck('a', 'b') */ suite.T().Log("About to run line #113: objArr.Pluck('a', 'b')") runAndAssert(suite.Suite, expected_, objArr.Pluck("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // transform/array.yaml line #115 /* [{'a':1}, {'a':2}, {'a':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}} /* objArr.pluck('a') */ suite.T().Log("About to run line #115: objArr.Pluck('a')") runAndAssert(suite.Suite, expected_, objArr.Pluck("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #115") } { // transform/array.yaml line #117 /* [{}, {}, {}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}} /* objArr.pluck() */ suite.T().Log("About to run line #117: objArr.Pluck()") runAndAssert(suite.Suite, expected_, objArr.Pluck(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #117") } // transform/array.yaml line #121 // wftst = objArr.union(objArr.pluck('a')).union(objArr.pluck('b')).union([{'a':null}]) suite.T().Log("Possibly executing: var wftst r.Term = objArr.Union(objArr.Pluck('a')).Union(objArr.Pluck('b')).Union([]interface{}{map[interface{}]interface{}{'a': nil, }})") wftst := objArr.Union(objArr.Pluck("a")).Union(objArr.Pluck("b")).Union([]interface{}{map[interface{}]interface{}{"a": nil}}) _ = wftst // Prevent any noused variable errors { // transform/array.yaml line #122 /* ([{'a':1},{'a':2},{'a':3},{'a':1},{'a':2},{'a':3}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}, map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}} /* wftst.with_fields('a') */ suite.T().Log("About to run line #122: wftst.WithFields('a')") runAndAssert(suite.Suite, expected_, wftst.WithFields("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // transform/array.yaml line #124 /* ([{'b':'a'},{'b':'b'},{'b':'c'},{'b':'a'},{'b':'b'},{'b':'c'}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"b": "a"}, map[interface{}]interface{}{"b": "b"}, map[interface{}]interface{}{"b": "c"}, map[interface{}]interface{}{"b": "a"}, map[interface{}]interface{}{"b": "b"}, map[interface{}]interface{}{"b": "c"}} /* wftst.with_fields('b') */ suite.T().Log("About to run line #124: wftst.WithFields('b')") runAndAssert(suite.Suite, expected_, wftst.WithFields("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #124") } { // transform/array.yaml line #126 /* ([{'a':1,'b':'a'},{'a':2,'b':'b'},{'a':3,'b':'c'}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}} /* wftst.with_fields('a', 'b') */ suite.T().Log("About to run line #126: wftst.WithFields('a', 'b')") runAndAssert(suite.Suite, expected_, wftst.WithFields("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #126") } { // transform/array.yaml line #128 /* [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}} /* wftst.with_fields() */ suite.T().Log("About to run line #128: wftst.WithFields()") runAndAssert(suite.Suite, expected_, wftst.WithFields(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #128") } // transform/array.yaml line #131 // wftst2 = nestedObjArr.union(objArr.pluck({'b':'missing'})).union(nestedObjArr.pluck({'b':'c'})) suite.T().Log("Possibly executing: var wftst2 r.Term = nestedObjArr.Union(objArr.Pluck(map[interface{}]interface{}{'b': 'missing', })).Union(nestedObjArr.Pluck(map[interface{}]interface{}{'b': 'c', }))") wftst2 := nestedObjArr.Union(objArr.Pluck(map[interface{}]interface{}{"b": "missing"})).Union(nestedObjArr.Pluck(map[interface{}]interface{}{"b": "c"})) _ = wftst2 // Prevent any noused variable errors { // transform/array.yaml line #132 /* ([{'b':{'c':1}}, {'b':{'c':2}}, {'b':{'c':3}}, {'b':{'c':1}}, {'b':{'c':2}}, {'b':{'c':3}}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 1}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 2}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 3}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 1}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 2}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 3}}} /* wftst2.with_fields({'b':'c'}) */ suite.T().Log("About to run line #132: wftst2.WithFields(map[interface{}]interface{}{'b': 'c', })") runAndAssert(suite.Suite, expected_, wftst2.WithFields(map[interface{}]interface{}{"b": "c"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } { // transform/array.yaml line #135 /* err("ReqlQueryLogicError", "Invalid path argument `1`.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Invalid path argument `1`.") /* wftst.with_fields(1) */ suite.T().Log("About to run line #135: wftst.WithFields(1)") runAndAssert(suite.Suite, expected_, wftst.WithFields(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // transform/array.yaml line #137 /* err("ReqlQueryLogicError", "Cannot perform has_fields on a non-object non-sequence `1`.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot perform has_fields on a non-object non-sequence `1`.") /* r.expr(1).with_fields() */ suite.T().Log("About to run line #137: r.Expr(1).WithFields()") runAndAssert(suite.Suite, expected_, r.Expr(1).WithFields(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #137") } { // transform/array.yaml line #142 /* [{}, {}, {}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}} /* objArr.without('a', 'b') */ suite.T().Log("About to run line #142: objArr.Without('a', 'b')") runAndAssert(suite.Suite, expected_, objArr.Without("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #142") } { // transform/array.yaml line #144 /* [{'b':'a'}, {'b':'b'}, {'b':'c'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"b": "a"}, map[interface{}]interface{}{"b": "b"}, map[interface{}]interface{}{"b": "c"}} /* objArr.without('a') */ suite.T().Log("About to run line #144: objArr.Without('a')") runAndAssert(suite.Suite, expected_, objArr.Without("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #144") } { // transform/array.yaml line #146 /* [{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}} /* objArr.without() */ suite.T().Log("About to run line #146: objArr.Without()") runAndAssert(suite.Suite, expected_, objArr.Without(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #146") } { // transform/array.yaml line #151 /* [2,3,4] */ var expected_ []interface{} = []interface{}{2, 3, 4} /* arr.map(lambda v: v + 1) */ suite.T().Log("About to run line #151: arr.Map(func(v r.Term) interface{} { return r.Add(v, 1)})") runAndAssert(suite.Suite, expected_, arr.Map(func(v r.Term) interface{} { return r.Add(v, 1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #151") } { // transform/array.yaml line #161 /* 6 */ var expected_ int = 6 /* arr.reduce(lambda a, b: a + b) */ suite.T().Log("About to run line #161: arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") runAndAssert(suite.Suite, expected_, arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #161") } { // transform/array.yaml line #166 /* 6 */ var expected_ int = 6 /* arr.reduce(lambda a, b:a + b) */ suite.T().Log("About to run line #166: arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") runAndAssert(suite.Suite, expected_, arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #166") } { // transform/array.yaml line #171 /* 12 */ var expected_ int = 12 /* arr.union(arr).reduce(lambda a, b: a + b) */ suite.T().Log("About to run line #171: arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") runAndAssert(suite.Suite, expected_, arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #171") } { // transform/array.yaml line #176 /* 12 */ var expected_ int = 12 /* arr.union(arr).reduce(lambda a, b:a + b) */ suite.T().Log("About to run line #176: arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") runAndAssert(suite.Suite, expected_, arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #176") } { // transform/array.yaml line #183 /* [{'a':2, 'b':'b'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 2, "b": "b"}} /* objArr.filter(lambda row: row['b'] == 'b') */ suite.T().Log("About to run line #183: objArr.Filter(func(row r.Term) interface{} { return row.AtIndex('b').Eq('b')})") runAndAssert(suite.Suite, expected_, objArr.Filter(func(row r.Term) interface{} { return row.AtIndex("b").Eq("b") }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #183") } { // transform/array.yaml line #190 /* [1,2,1,2,1,2] */ var expected_ []interface{} = []interface{}{1, 2, 1, 2, 1, 2} /* arr.concat_map(lambda v: [1,2]) */ suite.T().Log("About to run line #190: arr.ConcatMap(func(v r.Term) interface{} { return []interface{}{1, 2}})") runAndAssert(suite.Suite, expected_, arr.ConcatMap(func(v r.Term) interface{} { return []interface{}{1, 2} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #190") } { // transform/array.yaml line #194 /* [{'v':1}, {'v2':2}, {'v':2}, {'v2':3}, {'v':3}, {'v2':4}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"v": 1}, map[interface{}]interface{}{"v2": 2}, map[interface{}]interface{}{"v": 2}, map[interface{}]interface{}{"v2": 3}, map[interface{}]interface{}{"v": 3}, map[interface{}]interface{}{"v2": 4}} /* arr.concat_map(lambda v: [{'v':v}, {'v2':v + 1}]) */ suite.T().Log("About to run line #194: arr.ConcatMap(func(v r.Term) interface{} { return []interface{}{map[interface{}]interface{}{'v': v, }, map[interface{}]interface{}{'v2': r.Add(v, 1), }}})") runAndAssert(suite.Suite, expected_, arr.ConcatMap(func(v r.Term) interface{} { return []interface{}{map[interface{}]interface{}{"v": v}, map[interface{}]interface{}{"v2": r.Add(v, 1)}} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #194") } { // transform/array.yaml line #201 /* [{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}} /* objArr.order_by('b') */ suite.T().Log("About to run line #201: objArr.OrderBy('b')") runAndAssert(suite.Suite, expected_, objArr.OrderBy("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #201") } { // transform/array.yaml line #205 /* [{'a':3, 'b':'c'}, {'a':2, 'b':'b'}, {'a':1, 'b':'a'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 3, "b": "c"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 1, "b": "a"}} /* objArr.order_by(r.desc('b')) */ suite.T().Log("About to run line #205: objArr.OrderBy(r.Desc('b'))") runAndAssert(suite.Suite, expected_, objArr.OrderBy(r.Desc("b")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #205") } { // transform/array.yaml line #208 /* [{'-a':1},{'-a':2}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"-a": 1}, map[interface{}]interface{}{"-a": 2}} /* r.expr([{'-a':1},{'-a':2}]).order_by('-a') */ suite.T().Log("About to run line #208: r.Expr([]interface{}{map[interface{}]interface{}{'-a': 1, }, map[interface{}]interface{}{'-a': 2, }}).OrderBy('-a')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"-a": 1}, map[interface{}]interface{}{"-a": 2}}).OrderBy("-a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #208") } { // transform/array.yaml line #216 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,1,2,2,2,3,4]).distinct() */ suite.T().Log("About to run line #216: r.Expr([]interface{}{1, 1, 2, 2, 2, 3, 4}).Distinct()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 1, 2, 2, 2, 3, 4}).Distinct(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #216") } { // transform/array.yaml line #223 /* 3 */ var expected_ int = 3 /* objArr.count() */ suite.T().Log("About to run line #223: objArr.Count()") runAndAssert(suite.Suite, expected_, objArr.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #223") } { // transform/array.yaml line #228 /* [1, 2, 3, {'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */ var expected_ []interface{} = []interface{}{1, 2, 3, map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}} /* arr.union(objArr) */ suite.T().Log("About to run line #228: arr.Union(objArr)") runAndAssert(suite.Suite, expected_, arr.Union(objArr), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #228") } { // transform/array.yaml line #234 /* 2 */ var expected_ int = 2 /* arr[1] */ suite.T().Log("About to run line #234: arr.AtIndex(1)") runAndAssert(suite.Suite, expected_, arr.AtIndex(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #234") } { // transform/array.yaml line #235 /* 2 */ var expected_ int = 2 /* arr.nth(1) */ suite.T().Log("About to run line #235: arr.Nth(1)") runAndAssert(suite.Suite, expected_, arr.Nth(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #235") } { // transform/array.yaml line #238 /* 1 */ var expected_ int = 1 /* arr[0] */ suite.T().Log("About to run line #238: arr.AtIndex(0)") runAndAssert(suite.Suite, expected_, arr.AtIndex(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #238") } { // transform/array.yaml line #245 /* true */ var expected_ bool = true /* r.expr([]).is_empty() */ suite.T().Log("About to run line #245: r.Expr([]interface{}{}).IsEmpty()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).IsEmpty(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #245") } { // transform/array.yaml line #247 /* false */ var expected_ bool = false /* arr.is_empty() */ suite.T().Log("About to run line #247: arr.IsEmpty()") runAndAssert(suite.Suite, expected_, arr.IsEmpty(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #247") } { // transform/array.yaml line #251 /* true */ var expected_ bool = true /* arr.contains(2) */ suite.T().Log("About to run line #251: arr.Contains(2)") runAndAssert(suite.Suite, expected_, arr.Contains(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #251") } { // transform/array.yaml line #253 /* true */ var expected_ bool = true /* arr.contains(2, 3) */ suite.T().Log("About to run line #253: arr.Contains(2, 3)") runAndAssert(suite.Suite, expected_, arr.Contains(2, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #253") } { // transform/array.yaml line #255 /* false */ var expected_ bool = false /* arr.contains(4) */ suite.T().Log("About to run line #255: arr.Contains(4)") runAndAssert(suite.Suite, expected_, arr.Contains(4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #255") } { // transform/array.yaml line #257 /* false */ var expected_ bool = false /* arr.contains(2, 4) */ suite.T().Log("About to run line #257: arr.Contains(2, 4)") runAndAssert(suite.Suite, expected_, arr.Contains(2, 4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #257") } { // transform/array.yaml line #259 /* false */ var expected_ bool = false /* arr.contains(2, 2) */ suite.T().Log("About to run line #259: arr.Contains(2, 2)") runAndAssert(suite.Suite, expected_, arr.Contains(2, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #259") } { // transform/array.yaml line #261 /* true */ var expected_ bool = true /* arr.union(arr).contains(2, 2) */ suite.T().Log("About to run line #261: arr.Union(arr).Contains(2, 2)") runAndAssert(suite.Suite, expected_, arr.Union(arr).Contains(2, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #261") } { // transform/array.yaml line #265 /* true */ var expected_ bool = true /* arr.contains(lambda x:x == 2) */ suite.T().Log("About to run line #265: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)})") runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #265") } { // transform/array.yaml line #269 /* true */ var expected_ bool = true /* arr.contains(lambda x:x == 2, lambda x:x==3) */ suite.T().Log("About to run line #269: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 3)})") runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 3) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #269") } { // transform/array.yaml line #273 /* false */ var expected_ bool = false /* arr.contains(lambda x:x == 4) */ suite.T().Log("About to run line #273: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 4)})") runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 4) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #273") } { // transform/array.yaml line #277 /* false */ var expected_ bool = false /* arr.contains(lambda x:x == 2, lambda x:x==4) */ suite.T().Log("About to run line #277: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 4)})") runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 4) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #277") } { // transform/array.yaml line #281 /* false */ var expected_ bool = false /* arr.contains(lambda x:x == 2, lambda x:x==2) */ suite.T().Log("About to run line #281: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 2)})") runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 2) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #281") } { // transform/array.yaml line #285 /* true */ var expected_ bool = true /* arr.union(arr).contains(lambda x:x == 2, lambda x:x==2) */ suite.T().Log("About to run line #285: arr.Union(arr).Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 2)})") runAndAssert(suite.Suite, expected_, arr.Union(arr).Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 2) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #285") } { // transform/array.yaml line #290 /* [1, 3] */ var expected_ []interface{} = []interface{}{1, 3} /* r.expr([{'a':1},{'b':2},{'a':3,'c':4}])['a'] */ suite.T().Log("About to run line #290: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'a': 3, 'c': 4, }}).AtIndex('a')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"a": 3, "c": 4}}).AtIndex("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #290") } { // transform/array.yaml line #293 /* err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.") /* r.expr([{'a':1},'a',{'b':2},{'a':3,'c':4}])['a'] */ suite.T().Log("About to run line #293: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, 'a', map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'a': 3, 'c': 4, }}).AtIndex('a')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, "a", map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"a": 3, "c": 4}}).AtIndex("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #293") } }
func (suite *DatumObjectSuite) TestCases() { suite.T().Log("Running DatumObjectSuite: Tests conversion to and from the RQL object type") { // datum/object.yaml line #6 /* {} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{} /* r.expr({}) */ suite.T().Log("About to run line #6: r.Expr(map[interface{}]interface{}{})") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // datum/object.yaml line #11 /* {'a':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1} /* r.expr({'a':1}) */ suite.T().Log("About to run line #11: r.Expr(map[interface{}]interface{}{'a': 1, })") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // datum/object.yaml line #16 /* {'a':1, 'b':'two', 'c':True} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": "two", "c": true} /* r.expr({'a':1, 'b':'two', 'c':True}) */ suite.T().Log("About to run line #16: r.Expr(map[interface{}]interface{}{'a': 1, 'b': 'two', 'c': true, })") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1, "b": "two", "c": true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // datum/object.yaml line #20 /* {'a':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1} /* r.expr({'a':r.expr(1)}) */ suite.T().Log("About to run line #20: r.Expr(map[interface{}]interface{}{'a': r.Expr(1), })") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": r.Expr(1)}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // datum/object.yaml line #23 /* {'a':{'b':[{'c':2}, 'a', 4]}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": []interface{}{map[interface{}]interface{}{"c": 2}, "a", 4}}} /* r.expr({'a':{'b':[{'c':2}, 'a', 4]}}) */ suite.T().Log("About to run line #23: r.Expr(map[interface{}]interface{}{'a': map[interface{}]interface{}{'b': []interface{}{map[interface{}]interface{}{'c': 2, }, 'a', 4}, }, })") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": []interface{}{map[interface{}]interface{}{"c": 2}, "a", 4}}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // datum/object.yaml line #26 /* 'OBJECT' */ var expected_ string = "OBJECT" /* r.expr({'a':1}).type_of() */ suite.T().Log("About to run line #26: r.Expr(map[interface{}]interface{}{'a': 1, }).TypeOf()") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // datum/object.yaml line #30 /* '{"a":1}' */ var expected_ string = "{\"a\":1}" /* r.expr({'a':1}).coerce_to('string') */ suite.T().Log("About to run line #30: r.Expr(map[interface{}]interface{}{'a': 1, }).CoerceTo('string')") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).CoerceTo("string"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // datum/object.yaml line #34 /* {'a':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1} /* r.expr({'a':1}).coerce_to('object') */ suite.T().Log("About to run line #34: r.Expr(map[interface{}]interface{}{'a': 1, }).CoerceTo('object')") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).CoerceTo("object"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // datum/object.yaml line #37 /* [['a',1]] */ var expected_ []interface{} = []interface{}{[]interface{}{"a", 1}} /* r.expr({'a':1}).coerce_to('array') */ suite.T().Log("About to run line #37: r.Expr(map[interface{}]interface{}{'a': 1, }).CoerceTo('array')") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).CoerceTo("array"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // datum/object.yaml line #66 /* {} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{} /* r.object() */ suite.T().Log("About to run line #66: r.Object()") runAndAssert(suite.Suite, expected_, r.Object(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // datum/object.yaml line #69 /* {'a':1,'b':2} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2} /* r.object('a', 1, 'b', 2) */ suite.T().Log("About to run line #69: r.Object('a', 1, 'b', 2)") runAndAssert(suite.Suite, expected_, r.Object("a", 1, "b", 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } { // datum/object.yaml line #72 /* {'cd':3} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"cd": 3} /* r.object('c'+'d', 3) */ suite.T().Log("About to run line #72: r.Object(r.Add('c', 'd'), 3)") runAndAssert(suite.Suite, expected_, r.Object(r.Add("c", "d"), 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #72") } { // datum/object.yaml line #75 /* err("ReqlQueryLogicError", "OBJECT expects an even number of arguments (but found 3).", []) */ var expected_ Err = err("ReqlQueryLogicError", "OBJECT expects an even number of arguments (but found 3).") /* r.object('o','d','d') */ suite.T().Log("About to run line #75: r.Object('o', 'd', 'd')") runAndAssert(suite.Suite, expected_, r.Object("o", "d", "d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #75") } { // datum/object.yaml line #78 /* err("ReqlQueryLogicError","Expected type STRING but found NUMBER.",[]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* r.object(1, 1) */ suite.T().Log("About to run line #78: r.Object(1, 1)") runAndAssert(suite.Suite, expected_, r.Object(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // datum/object.yaml line #81 /* err("ReqlQueryLogicError","Duplicate key \"e\" in object. (got 4 and 5 as values)",[]) */ var expected_ Err = err("ReqlQueryLogicError", "Duplicate key \"e\" in object. (got 4 and 5 as values)") /* r.object('e', 4, 'e', 5) */ suite.T().Log("About to run line #81: r.Object('e', 4, 'e', 5)") runAndAssert(suite.Suite, expected_, r.Object("e", 4, "e", 5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // datum/object.yaml line #84 /* err("ReqlQueryLogicError","Expected type DATUM but found DATABASE:",[]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found DATABASE:") /* r.object('g', r.db('test')) */ suite.T().Log("About to run line #84: r.Object('g', r.DB('test'))") runAndAssert(suite.Suite, expected_, r.Object("g", r.DB("test")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #84") } }
func (suite *TimesTimezonesSuite) TestCases() { suite.T().Log("Running TimesTimezonesSuite: Test basic timezone manipulation") // times/timezones.yaml line #3 // t1 = r.time(2013, r.july, 29, 23, 30, 0, "+00:00") suite.T().Log("Possibly executing: var t1 r.Term = r.Time(2013, r.July, 29, 23, 30, 0, '+00:00')") t1 := r.Time(2013, r.July, 29, 23, 30, 0, "+00:00") _ = t1 // Prevent any noused variable errors // times/timezones.yaml line #5 // tutc1 = t1.in_timezone("Z") suite.T().Log("Possibly executing: var tutc1 r.Term = t1.InTimezone('Z')") tutc1 := t1.InTimezone("Z") _ = tutc1 // Prevent any noused variable errors // times/timezones.yaml line #6 // tutc2 = t1.in_timezone("+00:00") suite.T().Log("Possibly executing: var tutc2 r.Term = t1.InTimezone('+00:00')") tutc2 := t1.InTimezone("+00:00") _ = tutc2 // Prevent any noused variable errors // times/timezones.yaml line #7 // tutc3 = t1.in_timezone("+00") suite.T().Log("Possibly executing: var tutc3 r.Term = t1.InTimezone('+00')") tutc3 := t1.InTimezone("+00") _ = tutc3 // Prevent any noused variable errors // times/timezones.yaml line #8 // tutcs = r.expr([tutc1, tutc2, tutc3]) suite.T().Log("Possibly executing: var tutcs r.Term = r.Expr([]interface{}{tutc1, tutc2, tutc3})") tutcs := r.Expr([]interface{}{tutc1, tutc2, tutc3}) _ = tutcs // Prevent any noused variable errors // times/timezones.yaml line #10 // tm1 = t1.in_timezone("-00:59") suite.T().Log("Possibly executing: var tm1 r.Term = t1.InTimezone('-00:59')") tm1 := t1.InTimezone("-00:59") _ = tm1 // Prevent any noused variable errors // times/timezones.yaml line #11 // tm2 = t1.in_timezone("-01:00") suite.T().Log("Possibly executing: var tm2 r.Term = t1.InTimezone('-01:00')") tm2 := t1.InTimezone("-01:00") _ = tm2 // Prevent any noused variable errors // times/timezones.yaml line #12 // tm3 = t1.in_timezone("-01:01") suite.T().Log("Possibly executing: var tm3 r.Term = t1.InTimezone('-01:01')") tm3 := t1.InTimezone("-01:01") _ = tm3 // Prevent any noused variable errors // times/timezones.yaml line #13 // tms = r.expr([tm1, tm2, tm3]) suite.T().Log("Possibly executing: var tms r.Term = r.Expr([]interface{}{tm1, tm2, tm3})") tms := r.Expr([]interface{}{tm1, tm2, tm3}) _ = tms // Prevent any noused variable errors // times/timezones.yaml line #15 // tp1 = t1.in_timezone("+00:59") suite.T().Log("Possibly executing: var tp1 r.Term = t1.InTimezone('+00:59')") tp1 := t1.InTimezone("+00:59") _ = tp1 // Prevent any noused variable errors // times/timezones.yaml line #16 // tp2 = t1.in_timezone("+01:00") suite.T().Log("Possibly executing: var tp2 r.Term = t1.InTimezone('+01:00')") tp2 := t1.InTimezone("+01:00") _ = tp2 // Prevent any noused variable errors // times/timezones.yaml line #17 // tp3 = t1.in_timezone("+01:01") suite.T().Log("Possibly executing: var tp3 r.Term = t1.InTimezone('+01:01')") tp3 := t1.InTimezone("+01:01") _ = tp3 // Prevent any noused variable errors // times/timezones.yaml line #18 // tps = r.expr([tp1, tp2, tp3]) suite.T().Log("Possibly executing: var tps r.Term = r.Expr([]interface{}{tp1, tp2, tp3})") tps := r.Expr([]interface{}{tp1, tp2, tp3}) _ = tps // Prevent any noused variable errors // times/timezones.yaml line #20 // ts = tutcs.union(tms).union(tps).union([t1]) suite.T().Log("Possibly executing: var ts r.Term = tutcs.Union(tms).Union(tps).Union([]interface{}{t1})") ts := tutcs.Union(tms).Union(tps).Union([]interface{}{t1}) _ = ts // Prevent any noused variable errors { // times/timezones.yaml line #23 /* ([["+00:00", 29], ["+00:00", 29], ["+00:00", 29]]) */ var expected_ []interface{} = []interface{}{[]interface{}{"+00:00", 29}, []interface{}{"+00:00", 29}, []interface{}{"+00:00", 29}} /* tutcs.map(lambda x:[x.timezone(), x.day()]) */ suite.T().Log("About to run line #23: tutcs.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()}})") runAndAssert(suite.Suite, expected_, tutcs.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // times/timezones.yaml line #27 /* ([["-00:59", 29], ["-01:00", 29], ["-01:01", 29]]) */ var expected_ []interface{} = []interface{}{[]interface{}{"-00:59", 29}, []interface{}{"-01:00", 29}, []interface{}{"-01:01", 29}} /* tms.map(lambda x:[x.timezone(), x.day()]) */ suite.T().Log("About to run line #27: tms.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()}})") runAndAssert(suite.Suite, expected_, tms.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // times/timezones.yaml line #31 /* ([["+00:59", 30], ["+01:00", 30], ["+01:01", 30]]) */ var expected_ []interface{} = []interface{}{[]interface{}{"+00:59", 30}, []interface{}{"+01:00", 30}, []interface{}{"+01:01", 30}} /* tps.map(lambda x:[x.timezone(), x.day()]) */ suite.T().Log("About to run line #31: tps.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()}})") runAndAssert(suite.Suite, expected_, tps.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // times/timezones.yaml line #38 /* ([0]) */ var expected_ []interface{} = []interface{}{0} /* ts.concat_map(lambda x:ts.map(lambda y:x - y)).distinct() */ suite.T().Log("About to run line #38: ts.ConcatMap(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return r.Sub(x, y)})}).Distinct()") runAndAssert(suite.Suite, expected_, ts.ConcatMap(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return r.Sub(x, y) }) }).Distinct(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // times/timezones.yaml line #44 /* err('ReqlQueryLogicError', 'Timezone `` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `` does not start with `-` or `+`.") /* r.now().in_timezone("") */ suite.T().Log("About to run line #44: r.Now().InTimezone('')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone(""), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // times/timezones.yaml line #47 /* err('ReqlQueryLogicError', '`-00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00` is not a valid time offset.") /* r.now().in_timezone("-00") */ suite.T().Log("About to run line #47: r.Now().InTimezone('-00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("-00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // times/timezones.yaml line #50 /* err('ReqlQueryLogicError', '`-00:00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00:00` is not a valid time offset.") /* r.now().in_timezone("-00:00") */ suite.T().Log("About to run line #50: r.Now().InTimezone('-00:00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("-00:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // times/timezones.yaml line #53 /* err('ReqlQueryLogicError', 'Timezone `UTC+00` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `UTC+00` does not start with `-` or `+`.") /* r.now().in_timezone("UTC+00") */ suite.T().Log("About to run line #53: r.Now().InTimezone('UTC+00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("UTC+00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // times/timezones.yaml line #56 /* err('ReqlQueryLogicError', 'Minutes out of range in `+00:60`.') */ var expected_ Err = err("ReqlQueryLogicError", "Minutes out of range in `+00:60`.") /* r.now().in_timezone("+00:60") */ suite.T().Log("About to run line #56: r.Now().InTimezone('+00:60')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("+00:60"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #56") } { // times/timezones.yaml line #59 /* err('ReqlQueryLogicError', 'Hours out of range in `+25:00`.') */ var expected_ Err = err("ReqlQueryLogicError", "Hours out of range in `+25:00`.") /* r.now().in_timezone("+25:00") */ suite.T().Log("About to run line #59: r.Now().InTimezone('+25:00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("+25:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // times/timezones.yaml line #63 /* err('ReqlQueryLogicError', 'Timezone `` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `` does not start with `-` or `+`.") /* r.time(2013, 1, 1, "") */ suite.T().Log("About to run line #63: r.Time(2013, 1, 1, '')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, ""), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // times/timezones.yaml line #66 /* err('ReqlQueryLogicError', '`-00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00` is not a valid time offset.") /* r.time(2013, 1, 1, "-00") */ suite.T().Log("About to run line #66: r.Time(2013, 1, 1, '-00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "-00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // times/timezones.yaml line #69 /* err('ReqlQueryLogicError', '`-00:00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00:00` is not a valid time offset.") /* r.time(2013, 1, 1, "-00:00") */ suite.T().Log("About to run line #69: r.Time(2013, 1, 1, '-00:00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "-00:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } { // times/timezones.yaml line #72 /* err('ReqlQueryLogicError', 'Timezone `UTC+00` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `UTC+00` does not start with `-` or `+`.") /* r.time(2013, 1, 1, "UTC+00") */ suite.T().Log("About to run line #72: r.Time(2013, 1, 1, 'UTC+00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "UTC+00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #72") } { // times/timezones.yaml line #75 /* err('ReqlQueryLogicError', 'Minutes out of range in `+00:60`.') */ var expected_ Err = err("ReqlQueryLogicError", "Minutes out of range in `+00:60`.") /* r.time(2013, 1, 1, "+00:60") */ suite.T().Log("About to run line #75: r.Time(2013, 1, 1, '+00:60')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "+00:60"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #75") } { // times/timezones.yaml line #78 /* err('ReqlQueryLogicError', 'Hours out of range in `+25:00`.') */ var expected_ Err = err("ReqlQueryLogicError", "Hours out of range in `+25:00`.") /* r.time(2013, 1, 1, "+25:00") */ suite.T().Log("About to run line #78: r.Time(2013, 1, 1, '+25:00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "+25:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // times/timezones.yaml line #81 /* ("2015-07-08T00:00:00-08:00") */ var expected_ string = "2015-07-08T00:00:00-08:00" /* r.epoch_time(1436428422.339).in_timezone('-08:00').date().to_iso8601() */ suite.T().Log("About to run line #81: r.EpochTime(1436428422.339).InTimezone('-08:00').Date().ToISO8601()") runAndAssert(suite.Suite, expected_, r.EpochTime(1436428422.339).InTimezone("-08:00").Date().ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // times/timezones.yaml line #85 /* ("2015-07-09T00:00:00-07:00") */ var expected_ string = "2015-07-09T00:00:00-07:00" /* r.epoch_time(1436428422.339).in_timezone('-07:00').date().to_iso8601() */ suite.T().Log("About to run line #85: r.EpochTime(1436428422.339).InTimezone('-07:00').Date().ToISO8601()") runAndAssert(suite.Suite, expected_, r.EpochTime(1436428422.339).InTimezone("-07:00").Date().ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } }
func (suite *DatumNullSuite) TestCases() { suite.T().Log("Running DatumNullSuite: Tests of conversion to and from the RQL null type") { // datum/null.yaml line #6 /* (null) */ var expected_ interface{} = nil /* r.expr(null) */ suite.T().Log("About to run line #6: r.Expr(nil)") runAndAssert(suite.Suite, expected_, r.Expr(nil), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // datum/null.yaml line #9 /* 'NULL' */ var expected_ string = "NULL" /* r.expr(null).type_of() */ suite.T().Log("About to run line #9: 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 #9") } { // datum/null.yaml line #14 /* 'null' */ var expected_ string = "null" /* r.expr(null).coerce_to('string') */ suite.T().Log("About to run line #14: r.Expr(nil).CoerceTo('string')") runAndAssert(suite.Suite, expected_, r.Expr(nil).CoerceTo("string"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // datum/null.yaml line #17 /* null */ var expected_ interface{} = nil /* r.expr(null).coerce_to('null') */ suite.T().Log("About to run line #17: r.Expr(nil).CoerceTo('null')") runAndAssert(suite.Suite, expected_, r.Expr(nil).CoerceTo("null"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } }
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") } }
func (suite *TransformMapSuite) TestCases() { suite.T().Log("Running TransformMapSuite: Tests the RQL `map` function") { // transform/map.yaml line #5 /* 'STREAM' */ var expected_ string = "STREAM" /* r.range().map(r.range(), lambda x, y:(x, y)).type_of() */ suite.T().Log("About to run line #5: r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).TypeOf()") runAndAssert(suite.Suite, expected_, r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // transform/map.yaml line #10 /* 'STREAM' */ var expected_ string = "STREAM" /* r.range().map(r.expr([]), lambda x, y:(x, y)).type_of() */ suite.T().Log("About to run line #10: r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).TypeOf()") runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // transform/map.yaml line #15 /* 'ARRAY' */ var expected_ string = "ARRAY" /* r.expr([]).map(r.expr([]), lambda x, y:(x, y)).type_of() */ suite.T().Log("About to run line #15: r.Expr([]interface{}{}).Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).TypeOf()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // transform/map.yaml line #21 /* [0, 0, 0] */ var expected_ []interface{} = []interface{}{0, 0, 0} /* r.range(3).map(lambda:0) */ suite.T().Log("About to run line #21: r.Range(3).Map(func() interface{} { return 0})") runAndAssert(suite.Suite, expected_, r.Range(3).Map(func() interface{} { return 0 }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // transform/map.yaml line #26 /* [0, 0, 0] */ var expected_ []interface{} = []interface{}{0, 0, 0} /* r.range(3).map(r.range(4), lambda x,y:0) */ suite.T().Log("About to run line #26: r.Range(3).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return 0})") runAndAssert(suite.Suite, expected_, r.Range(3).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return 0 }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // transform/map.yaml line #31 /* [[1]] */ var expected_ []interface{} = []interface{}{[]interface{}{1}} /* r.expr([1]).map(lambda x:(x,)) */ suite.T().Log("About to run line #31: r.Expr([]interface{}{1}).Map(func(x r.Term) interface{} { return []interface{}{x}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(func(x r.Term) interface{} { return []interface{}{x} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // transform/map.yaml line #36 /* [[1, 1]] */ var expected_ []interface{} = []interface{}{[]interface{}{1, 1}} /* r.expr([1]).map(r.expr([1]), lambda x, y:(x, y)) */ suite.T().Log("About to run line #36: r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // transform/map.yaml line #41 /* [[1, 1, 1]] */ var expected_ []interface{} = []interface{}{[]interface{}{1, 1, 1}} /* r.expr([1]).map(r.expr([1]), r.expr([1]), lambda x, y, z:(x, y, z)) */ suite.T().Log("About to run line #41: r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), r.Expr([]interface{}{1}), func(x r.Term, y r.Term, z r.Term) interface{} { return []interface{}{x, y, z}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), r.Expr([]interface{}{1}), func(x r.Term, y r.Term, z r.Term) interface{} { return []interface{}{x, y, z} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #41") } { // transform/map.yaml line #47 /* err("ReqlQueryLogicError", "The function passed to `map` expects 2 arguments, but 1 sequence was found.", []) */ var expected_ Err = err("ReqlQueryLogicError", "The function passed to `map` expects 2 arguments, but 1 sequence was found.") /* r.expr([1]).map(lambda x, y:(x, y)) */ suite.T().Log("About to run line #47: r.Expr([]interface{}{1}).Map(func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // transform/map.yaml line #52 /* err("ReqlQueryLogicError", "The function passed to `map` expects 1 argument, but 2 sequences were found.", []) */ var expected_ Err = err("ReqlQueryLogicError", "The function passed to `map` expects 1 argument, but 2 sequences were found.") /* r.expr([1]).map(r.expr([1]), lambda x:(x,)) */ suite.T().Log("About to run line #52: r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term) interface{} { return []interface{}{x}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).Map(r.Expr([]interface{}{1}), func(x r.Term) interface{} { return []interface{}{x} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // transform/map.yaml line #58 /* [] */ var expected_ []interface{} = []interface{}{} /* r.range().map(r.expr([]), lambda x, y:(x, y)) */ suite.T().Log("About to run line #58: r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr([]interface{}{}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // transform/map.yaml line #63 /* [[1, 1], [2, 2]] */ var expected_ []interface{} = []interface{}{[]interface{}{1, 1}, []interface{}{2, 2}} /* r.expr([1, 2]).map(r.expr([1, 2, 3, 4]), lambda x, y:(x, y)) */ suite.T().Log("About to run line #63: r.Expr([]interface{}{1, 2}).Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // transform/map.yaml line #68 /* [[0, 0], [1, 1]] */ var expected_ []interface{} = []interface{}{[]interface{}{0, 0}, []interface{}{1, 1}} /* r.range(2).map(r.range(4), lambda x, y:(x, y)) */ suite.T().Log("About to run line #68: r.Range(2).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Range(2).Map(r.Range(4), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // transform/map.yaml line #73 /* [[0, 1], [1, 2], [2, 3], [3, 4]] */ var expected_ []interface{} = []interface{}{[]interface{}{0, 1}, []interface{}{1, 2}, []interface{}{2, 3}, []interface{}{3, 4}} /* r.range().map(r.expr([1, 2, 3, 4]), lambda x, y:(x, y)) */ suite.T().Log("About to run line #73: r.Range().Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr([]interface{}{1, 2, 3, 4}), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // transform/map.yaml line #78 /* [[0, 0], [1, 1], [2, 2]] */ var expected_ []interface{} = []interface{}{[]interface{}{0, 0}, []interface{}{1, 1}, []interface{}{2, 2}} /* r.range(3).map(r.range(5), r.js("(function(x, y){return [x, y];})")) */ suite.T().Log("About to run line #78: r.Range(3).Map(r.Range(5), r.JS('(function(x, y){return [x, y];})'))") runAndAssert(suite.Suite, expected_, r.Range(3).Map(r.Range(5), r.JS("(function(x, y){return [x, y];})")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // transform/map.yaml line #83 /* err("ReqlQueryLogicError", "Cannot convert NUMBER to SEQUENCE", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert NUMBER to SEQUENCE") /* r.range().map(r.expr(1), lambda x, y:(x, y)) */ suite.T().Log("About to run line #83: r.Range().Map(r.Expr(1), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Range().Map(r.Expr(1), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } { // transform/map.yaml line #89 /* err("ReqlQueryLogicError", "Cannot use an infinite stream with an aggregation function (`reduce`, `count`, etc.) or coerce it to an array.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot use an infinite stream with an aggregation function (`reduce`, `count`, etc.) or coerce it to an array.") /* r.range().map(r.range(), lambda x, y:(x, y)).count() */ suite.T().Log("About to run line #89: r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}}).Count()") runAndAssert(suite.Suite, expected_, r.Range().Map(r.Range(), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // transform/map.yaml line #95 /* [[0], [1], [2]] */ var expected_ []interface{} = []interface{}{[]interface{}{0}, []interface{}{1}, []interface{}{2}} /* r.map(r.range(3), lambda x:(x,)) */ suite.T().Log("About to run line #95: r.Map(r.Range(3), func(x r.Term) interface{} { return []interface{}{x}})") runAndAssert(suite.Suite, expected_, r.Map(r.Range(3), func(x r.Term) interface{} { return []interface{}{x} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // transform/map.yaml line #100 /* [1, 2, 3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.map(r.range(3), r.row + 1) */ suite.T().Log("About to run line #100: r.Map(r.Range(3), r.Row.Add(1))") runAndAssert(suite.Suite, expected_, r.Map(r.Range(3), r.Row.Add(1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #100") } { // transform/map.yaml line #104 /* [[0, 0], [1, 1], [2, 2]] */ var expected_ []interface{} = []interface{}{[]interface{}{0, 0}, []interface{}{1, 1}, []interface{}{2, 2}} /* r.map(r.range(3), r.range(5), lambda x, y:(x, y)) */ suite.T().Log("About to run line #104: r.Map(r.Range(3), r.Range(5), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y}})") runAndAssert(suite.Suite, expected_, r.Map(r.Range(3), r.Range(5), func(x r.Term, y r.Term) interface{} { return []interface{}{x, y} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #104") } }
func (suite *RandomSuite) TestCases() { suite.T().Log("Running RandomSuite: Tests randomization functions") { // random.yaml line #5 /* 3 */ var expected_ int = 3 /* r.expr([1,2,3]).sample(3).distinct().count() */ suite.T().Log("About to run line #5: r.Expr([]interface{}{1, 2, 3}).Sample(3).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Sample(3).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // random.yaml line #7 /* 3 */ var expected_ int = 3 /* r.expr([1,2,3]).sample(3).count() */ suite.T().Log("About to run line #7: r.Expr([]interface{}{1, 2, 3}).Sample(3).Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Sample(3).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // random.yaml line #9 /* 3 */ var expected_ int = 3 /* r.expr([1,2,3,4,5,6]).sample(3).distinct().count() */ suite.T().Log("About to run line #9: r.Expr([]interface{}{1, 2, 3, 4, 5, 6}).Sample(3).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4, 5, 6}).Sample(3).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // random.yaml line #11 /* 3 */ var expected_ int = 3 /* r.expr([1,2,3]).sample(4).distinct().count() */ suite.T().Log("About to run line #11: r.Expr([]interface{}{1, 2, 3}).Sample(4).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Sample(4).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // random.yaml line #15 /* err('ReqlQueryLogicError', 'Number of items to sample must be non-negative, got `-1`.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Number of items to sample must be non-negative, got `-1`.") /* r.expr([1,2,3]).sample(-1) */ suite.T().Log("About to run line #15: r.Expr([]interface{}{1, 2, 3}).Sample(-1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Sample(-1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // random.yaml line #17 /* err('ReqlQueryLogicError', 'Cannot convert NUMBER to SEQUENCE', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert NUMBER to SEQUENCE") /* r.expr(1).sample(1) */ suite.T().Log("About to run line #17: r.Expr(1).Sample(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Sample(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // random.yaml line #19 /* err('ReqlQueryLogicError', 'Cannot convert OBJECT to SEQUENCE', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert OBJECT to SEQUENCE") /* r.expr({}).sample(1) */ suite.T().Log("About to run line #19: r.Expr(map[interface{}]interface{}{}).Sample(1)") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).Sample(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // random.yaml line #25 /* True */ var expected_ bool = true /* r.random().do(lambda x:r.and_(x.ge(0), x.lt(1))) */ suite.T().Log("About to run line #25: r.Random().Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1))})") runAndAssert(suite.Suite, expected_, r.Random().Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // random.yaml line #26 /* True */ var expected_ bool = true /* r.random(1, float=True).do(lambda x:r.and_(x.ge(0), x.lt(1))) */ suite.T().Log("About to run line #26: r.Random(1).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1))})") runAndAssert(suite.Suite, expected_, r.Random(1).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // random.yaml line #27 /* True */ var expected_ bool = true /* r.random(0, 1, float=True).do(lambda x:r.and_(x.ge(0), x.lt(1))) */ suite.T().Log("About to run line #27: r.Random(0, 1).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1))})") runAndAssert(suite.Suite, expected_, r.Random(0, 1).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // random.yaml line #28 /* True */ var expected_ bool = true /* r.random(1, 0, float=True).do(lambda x:r.and_(x.le(1), x.gt(0))) */ suite.T().Log("About to run line #28: r.Random(1, 0).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(1), x.Gt(0))})") runAndAssert(suite.Suite, expected_, r.Random(1, 0).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(1), x.Gt(0)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // random.yaml line #29 /* True */ var expected_ bool = true /* r.random(r.expr(0), 1, float=True).do(lambda x:r.and_(x.ge(0), x.lt(1))) */ suite.T().Log("About to run line #29: r.Random(r.Expr(0), 1).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1))})") runAndAssert(suite.Suite, expected_, r.Random(r.Expr(0), 1).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // random.yaml line #30 /* True */ var expected_ bool = true /* r.random(1, r.expr(0), float=True).do(lambda x:r.and_(x.le(1), x.gt(0))) */ suite.T().Log("About to run line #30: r.Random(1, r.Expr(0)).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(1), x.Gt(0))})") runAndAssert(suite.Suite, expected_, r.Random(1, r.Expr(0)).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(1), x.Gt(0)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // random.yaml line #31 /* True */ var expected_ bool = true /* r.random(r.expr(1), r.expr(0), float=True).do(lambda x:r.and_(x.le(1), x.gt(0))) */ suite.T().Log("About to run line #31: r.Random(r.Expr(1), r.Expr(0)).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(1), x.Gt(0))})") runAndAssert(suite.Suite, expected_, r.Random(r.Expr(1), r.Expr(0)).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(1), x.Gt(0)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // random.yaml line #36 /* True */ var expected_ bool = true /* r.random(0.495, float=True).do(lambda x:r.and_(x.ge(0), x.lt(0.495))) */ suite.T().Log("About to run line #36: r.Random(0.495).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(0.495))})") runAndAssert(suite.Suite, expected_, r.Random(0.495).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(0.495)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // random.yaml line #37 /* True */ var expected_ bool = true /* r.random(-0.495, float=True).do(lambda x:r.and_(x.le(0), x.gt(-0.495))) */ suite.T().Log("About to run line #37: r.Random(-0.495).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(0), x.Gt(-0.495))})") runAndAssert(suite.Suite, expected_, r.Random(-0.495).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(0), x.Gt(-0.495)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // random.yaml line #38 /* True */ var expected_ bool = true /* r.random(1823756.24, float=True).do(lambda x:r.and_(x.ge(0), x.lt(1823756.24))) */ suite.T().Log("About to run line #38: r.Random(1823756.24).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1823756.24))})") runAndAssert(suite.Suite, expected_, r.Random(1823756.24).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(1823756.24)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // random.yaml line #39 /* True */ var expected_ bool = true /* r.random(-1823756.24, float=True).do(lambda x:r.and_(x.le(0), x.gt(-1823756.24))) */ suite.T().Log("About to run line #39: r.Random(-1823756.24).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(0), x.Gt(-1823756.24))})") runAndAssert(suite.Suite, expected_, r.Random(-1823756.24).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(0), x.Gt(-1823756.24)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // random.yaml line #44 /* True */ var expected_ bool = true /* r.random(10.5, 20.153, float=True).do(lambda x:r.and_(x.ge(10.5), x.lt(20.153))) */ suite.T().Log("About to run line #44: r.Random(10.5, 20.153).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(10.5), x.Lt(20.153))})") runAndAssert(suite.Suite, expected_, r.Random(10.5, 20.153).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(10.5), x.Lt(20.153)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // random.yaml line #45 /* True */ var expected_ bool = true /* r.random(20.153, 10.5, float=True).do(lambda x:r.and_(x.le(20.153), x.gt(10.5))) */ suite.T().Log("About to run line #45: r.Random(20.153, 10.5).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(20.153), x.Gt(10.5))})") runAndAssert(suite.Suite, expected_, r.Random(20.153, 10.5).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(20.153), x.Gt(10.5)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #45") } { // random.yaml line #46 /* True */ var expected_ bool = true /* r.random(31415926.1, 31415926, float=True).do(lambda x:r.and_(x.le(31415926.1), x.gt(31415926))) */ suite.T().Log("About to run line #46: r.Random(31415926.1, 31415926).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(31415926.1), x.Gt(31415926))})") runAndAssert(suite.Suite, expected_, r.Random(31415926.1, 31415926).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(31415926.1), x.Gt(31415926)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // random.yaml line #51 /* True */ var expected_ bool = true /* r.random(-10.5, 20.153, float=True).do(lambda x:r.and_(x.ge(-10.5), x.lt(20.153))) */ suite.T().Log("About to run line #51: r.Random(-10.5, 20.153).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(-10.5), x.Lt(20.153))})") runAndAssert(suite.Suite, expected_, r.Random(-10.5, 20.153).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(-10.5), x.Lt(20.153)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // random.yaml line #52 /* True */ var expected_ bool = true /* r.random(-20.153, -10.5, float=True).do(lambda x:r.and_(x.ge(-20.153), x.lt(-10.5))) */ suite.T().Log("About to run line #52: r.Random(-20.153, -10.5).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(-20.153), x.Lt(-10.5))})") runAndAssert(suite.Suite, expected_, r.Random(-20.153, -10.5).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(-20.153), x.Lt(-10.5)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // random.yaml line #53 /* True */ var expected_ bool = true /* r.random(-31415926, -31415926.1, float=True).do(lambda x:r.and_(x.le(-31415926), x.gt(-31415926.1))) */ suite.T().Log("About to run line #53: r.Random(-31415926, -31415926.1).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(-31415926), x.Gt(-31415926.1))})") runAndAssert(suite.Suite, expected_, r.Random(-31415926, -31415926.1).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(-31415926), x.Gt(-31415926.1)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // random.yaml line #58 /* 2 */ var expected_ int = 2 /* r.expr([r.random(), r.random()]).distinct().count() */ suite.T().Log("About to run line #58: r.Expr([]interface{}{r.Random(), r.Random()}).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Random(), r.Random()}).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // random.yaml line #59 /* 2 */ var expected_ int = 2 /* r.expr([r.random(1, float=True), r.random(1, float=True)]).distinct().count() */ suite.T().Log("About to run line #59: r.Expr([]interface{}{r.Random(1).OptArgs(r.RandomOpts{Float: true, }), r.Random(1).OptArgs(r.RandomOpts{Float: true, })}).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Random(1).OptArgs(r.RandomOpts{Float: true}), r.Random(1).OptArgs(r.RandomOpts{Float: true})}).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // random.yaml line #60 /* 2 */ var expected_ int = 2 /* r.expr([r.random(0, 1, float=True), r.random(0, 1, float=True)]).distinct().count() */ suite.T().Log("About to run line #60: r.Expr([]interface{}{r.Random(0, 1).OptArgs(r.RandomOpts{Float: true, }), r.Random(0, 1).OptArgs(r.RandomOpts{Float: true, })}).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Random(0, 1).OptArgs(r.RandomOpts{Float: true}), r.Random(0, 1).OptArgs(r.RandomOpts{Float: true})}).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // random.yaml line #65 /* True */ var expected_ bool = true /* r.random(0, float=True).eq(0) */ suite.T().Log("About to run line #65: r.Random(0).OptArgs(r.RandomOpts{Float: true, }).Eq(0)") runAndAssert(suite.Suite, expected_, r.Random(0).OptArgs(r.RandomOpts{Float: true}).Eq(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // random.yaml line #66 /* True */ var expected_ bool = true /* r.random(5, 5, float=True).eq(5) */ suite.T().Log("About to run line #66: r.Random(5, 5).OptArgs(r.RandomOpts{Float: true, }).Eq(5)") runAndAssert(suite.Suite, expected_, r.Random(5, 5).OptArgs(r.RandomOpts{Float: true}).Eq(5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // random.yaml line #67 /* True */ var expected_ bool = true /* r.random(-499384756758, -499384756758, float=True).eq(-499384756758) */ suite.T().Log("About to run line #67: r.Random(-499384756758, -499384756758).OptArgs(r.RandomOpts{Float: true, }).Eq(-499384756758)") runAndAssert(suite.Suite, expected_, r.Random(-499384756758, -499384756758).OptArgs(r.RandomOpts{Float: true}).Eq(-499384756758), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #67") } { // random.yaml line #68 /* True */ var expected_ bool = true /* r.random(-93.94757, -93.94757, float=True).eq(-93.94757) */ suite.T().Log("About to run line #68: r.Random(-93.94757, -93.94757).OptArgs(r.RandomOpts{Float: true, }).Eq(-93.94757)") runAndAssert(suite.Suite, expected_, r.Random(-93.94757, -93.94757).OptArgs(r.RandomOpts{Float: true}).Eq(-93.94757), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // random.yaml line #69 /* True */ var expected_ bool = true /* r.random(294.69148, 294.69148, float=True).eq(294.69148) */ suite.T().Log("About to run line #69: r.Random(294.69148, 294.69148).OptArgs(r.RandomOpts{Float: true, }).Eq(294.69148)") runAndAssert(suite.Suite, expected_, r.Random(294.69148, 294.69148).OptArgs(r.RandomOpts{Float: true}).Eq(294.69148), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } // random.yaml line #74 // float_max = sys.float_info.max suite.T().Log("Possibly executing: var float_max float64 = sys.FloatInfo.Max") float_max := sys.FloatInfo.Max _ = float_max // Prevent any noused variable errors // random.yaml line #78 // float_min = sys.float_info.min suite.T().Log("Possibly executing: var float_min float64 = sys.FloatInfo.Min") float_min := sys.FloatInfo.Min _ = float_min // Prevent any noused variable errors { // random.yaml line #82 /* True */ var expected_ bool = true /* r.random(-float_max, float_max, float=True).do(lambda x:r.and_(x.ge(-float_max), x.lt(float_max))) */ suite.T().Log("About to run line #82: r.Random(-float_max, float_max).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(-float_max), x.Lt(float_max))})") runAndAssert(suite.Suite, expected_, r.Random(-float_max, float_max).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(-float_max), x.Lt(float_max)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #82") } { // random.yaml line #83 /* True */ var expected_ bool = true /* r.random(float_max, -float_max, float=True).do(lambda x:r.and_(x.le(float_max), x.gt(-float_max))) */ suite.T().Log("About to run line #83: r.Random(float_max, -float_max).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(float_max), x.Gt(-float_max))})") runAndAssert(suite.Suite, expected_, r.Random(float_max, -float_max).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(float_max), x.Gt(-float_max)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } { // random.yaml line #84 /* True */ var expected_ bool = true /* r.random(float_min, float_max, float=True).do(lambda x:r.and_(x.ge(float_min), x.lt(float_max))) */ suite.T().Log("About to run line #84: r.Random(float_min, float_max).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(float_min), x.Lt(float_max))})") runAndAssert(suite.Suite, expected_, r.Random(float_min, float_max).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(float_min), x.Lt(float_max)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #84") } { // random.yaml line #85 /* True */ var expected_ bool = true /* r.random(float_min, -float_max, float=True).do(lambda x:r.and_(x.le(float_min), x.gt(-float_max))) */ suite.T().Log("About to run line #85: r.Random(float_min, -float_max).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(float_min), x.Gt(-float_max))})") runAndAssert(suite.Suite, expected_, r.Random(float_min, -float_max).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(float_min), x.Gt(-float_max)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } { // random.yaml line #86 /* True */ var expected_ bool = true /* r.random(-float_min, float_max, float=True).do(lambda x:r.and_(x.ge(-float_min), x.lt(float_max))) */ suite.T().Log("About to run line #86: r.Random(-float_min, float_max).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Ge(-float_min), x.Lt(float_max))})") runAndAssert(suite.Suite, expected_, r.Random(-float_min, float_max).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Ge(-float_min), x.Lt(float_max)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // random.yaml line #87 /* True */ var expected_ bool = true /* r.random(-float_min, -float_max, float=True).do(lambda x:r.and_(x.le(-float_min), x.gt(-float_max))) */ suite.T().Log("About to run line #87: r.Random(-float_min, -float_max).OptArgs(r.RandomOpts{Float: true, }).Do(func(x r.Term) interface{} { return r.And(x.Le(-float_min), x.Gt(-float_max))})") runAndAssert(suite.Suite, expected_, r.Random(-float_min, -float_max).OptArgs(r.RandomOpts{Float: true}).Do(func(x r.Term) interface{} { return r.And(x.Le(-float_min), x.Gt(-float_max)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #87") } // random.yaml line #92 // upper_limit = 2**53 - 1 suite.T().Log("Possibly executing: var upper_limit int = 2<<52 - 1") upper_limit := 2<<52 - 1 _ = upper_limit // Prevent any noused variable errors // random.yaml line #96 // lower_limit = 1 - (2**53) suite.T().Log("Possibly executing: var lower_limit int = 1 - 2<<52") lower_limit := 1 - 2<<52 _ = lower_limit // Prevent any noused variable errors { // random.yaml line #101 /* True */ var expected_ bool = true /* r.random(256).do(lambda x:r.and_(x.ge(0), x.lt(256))) */ suite.T().Log("About to run line #101: r.Random(256).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256))})") runAndAssert(suite.Suite, expected_, r.Random(256).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // random.yaml line #102 /* True */ var expected_ bool = true /* r.random(0, 256).do(lambda x:r.and_(x.ge(0), x.lt(256))) */ suite.T().Log("About to run line #102: r.Random(0, 256).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256))})") runAndAssert(suite.Suite, expected_, r.Random(0, 256).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #102") } { // random.yaml line #103 /* True */ var expected_ bool = true /* r.random(r.expr(256)).do(lambda x:r.and_(x.ge(0), x.lt(256))) */ suite.T().Log("About to run line #103: r.Random(r.Expr(256)).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256))})") runAndAssert(suite.Suite, expected_, r.Random(r.Expr(256)).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // random.yaml line #104 /* True */ var expected_ bool = true /* r.random(r.expr(0), 256).do(lambda x:r.and_(x.ge(0), x.lt(256))) */ suite.T().Log("About to run line #104: r.Random(r.Expr(0), 256).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256))})") runAndAssert(suite.Suite, expected_, r.Random(r.Expr(0), 256).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #104") } { // random.yaml line #105 /* True */ var expected_ bool = true /* r.random(0, r.expr(256)).do(lambda x:r.and_(x.ge(0), x.lt(256))) */ suite.T().Log("About to run line #105: r.Random(0, r.Expr(256)).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256))})") runAndAssert(suite.Suite, expected_, r.Random(0, r.Expr(256)).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // random.yaml line #106 /* True */ var expected_ bool = true /* r.random(r.expr(0), r.expr(256)).do(lambda x:r.and_(x.ge(0), x.lt(256))) */ suite.T().Log("About to run line #106: r.Random(r.Expr(0), r.Expr(256)).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256))})") runAndAssert(suite.Suite, expected_, r.Random(r.Expr(0), r.Expr(256)).Do(func(x r.Term) interface{} { return r.And(x.Ge(0), x.Lt(256)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #106") } { // random.yaml line #111 /* True */ var expected_ bool = true /* r.random(10, 20).do(lambda x:r.and_(x.ge(10), x.lt(20))) */ suite.T().Log("About to run line #111: r.Random(10, 20).Do(func(x r.Term) interface{} { return r.And(x.Ge(10), x.Lt(20))})") runAndAssert(suite.Suite, expected_, r.Random(10, 20).Do(func(x r.Term) interface{} { return r.And(x.Ge(10), x.Lt(20)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } { // random.yaml line #112 /* True */ var expected_ bool = true /* r.random(9347849, 120937493).do(lambda x:r.and_(x.ge(9347849), x.lt(120937493))) */ suite.T().Log("About to run line #112: r.Random(9347849, 120937493).Do(func(x r.Term) interface{} { return r.And(x.Ge(9347849), x.Lt(120937493))})") runAndAssert(suite.Suite, expected_, r.Random(9347849, 120937493).Do(func(x r.Term) interface{} { return r.And(x.Ge(9347849), x.Lt(120937493)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #112") } { // random.yaml line #123 /* True */ var expected_ bool = true /* r.random(-10, 20).do(lambda x:r.and_(x.ge(-10), x.lt(20))) */ suite.T().Log("About to run line #123: r.Random(-10, 20).Do(func(x r.Term) interface{} { return r.And(x.Ge(-10), x.Lt(20))})") runAndAssert(suite.Suite, expected_, r.Random(-10, 20).Do(func(x r.Term) interface{} { return r.And(x.Ge(-10), x.Lt(20)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #123") } { // random.yaml line #124 /* True */ var expected_ bool = true /* r.random(-20, -10).do(lambda x:r.and_(x.ge(-20), x.lt(-10))) */ suite.T().Log("About to run line #124: r.Random(-20, -10).Do(func(x r.Term) interface{} { return r.And(x.Ge(-20), x.Lt(-10))})") runAndAssert(suite.Suite, expected_, r.Random(-20, -10).Do(func(x r.Term) interface{} { return r.And(x.Ge(-20), x.Lt(-10)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #124") } { // random.yaml line #125 /* True */ var expected_ bool = true /* r.random(-120937493, -9347849).do(lambda x:r.and_(x.ge(-120937493), x.lt(-9347849))) */ suite.T().Log("About to run line #125: r.Random(-120937493, -9347849).Do(func(x r.Term) interface{} { return r.And(x.Ge(-120937493), x.Lt(-9347849))})") runAndAssert(suite.Suite, expected_, r.Random(-120937493, -9347849).Do(func(x r.Term) interface{} { return r.And(x.Ge(-120937493), x.Lt(-9347849)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // random.yaml line #137 /* 2 */ var expected_ int = 2 /* r.expr([r.random(upper_limit), r.random(upper_limit)]).distinct().count() */ suite.T().Log("About to run line #137: r.Expr([]interface{}{r.Random(upper_limit), r.Random(upper_limit)}).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Random(upper_limit), r.Random(upper_limit)}).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #137") } { // random.yaml line #139 /* 2 */ var expected_ int = 2 /* r.expr([upper_limit,upper_limit]).map(lambda x:r.random(x)).distinct().count() */ suite.T().Log("About to run line #139: r.Expr([]interface{}{upper_limit, upper_limit}).Map(func(x r.Term) interface{} { return r.Random(x)}).Distinct().Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{upper_limit, upper_limit}).Map(func(x r.Term) interface{} { return r.Random(x) }).Distinct().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #139") } { // random.yaml line #147 /* err("ReqlQueryLogicError", "Upper bound (-0.5) could not be safely converted to an integer.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Upper bound (-0.5) could not be safely converted to an integer.") /* r.random(-0.5) */ suite.T().Log("About to run line #147: r.Random(-0.5)") runAndAssert(suite.Suite, expected_, r.Random(-0.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #147") } { // random.yaml line #149 /* err("ReqlQueryLogicError", "Upper bound (0.25) could not be safely converted to an integer.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Upper bound (0.25) could not be safely converted to an integer.") /* r.random(0.25) */ suite.T().Log("About to run line #149: r.Random(0.25)") runAndAssert(suite.Suite, expected_, r.Random(0.25), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #149") } { // random.yaml line #151 /* err("ReqlQueryLogicError", "Upper bound (0.75) could not be safely converted to an integer.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Upper bound (0.75) could not be safely converted to an integer.") /* r.random(-10, 0.75) */ suite.T().Log("About to run line #151: r.Random(-10, 0.75)") runAndAssert(suite.Suite, expected_, r.Random(-10, 0.75), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #151") } { // random.yaml line #153 /* err("ReqlQueryLogicError", "Lower bound (-120549.25) could not be safely converted to an integer.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (-120549.25) could not be safely converted to an integer.") /* r.random(-120549.25, 39458) */ suite.T().Log("About to run line #153: r.Random(-120549.25, 39458)") runAndAssert(suite.Suite, expected_, r.Random(-120549.25, 39458), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #153") } { // random.yaml line #155 /* err("ReqlQueryLogicError", "Lower bound (-6.5) could not be safely converted to an integer.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (-6.5) could not be safely converted to an integer.") /* r.random(-6.5, 8.125) */ suite.T().Log("About to run line #155: r.Random(-6.5, 8.125)") runAndAssert(suite.Suite, expected_, r.Random(-6.5, 8.125), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #155") } { // random.yaml line #159 /* err("ReqlQueryLogicError", "Generating a random integer requires one or two bounds.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Generating a random integer requires one or two bounds.") /* r.random(float=False) */ suite.T().Log("About to run line #159: r.Random().OptArgs(r.RandomOpts{Float: false, })") runAndAssert(suite.Suite, expected_, r.Random().OptArgs(r.RandomOpts{Float: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // random.yaml line #165 /* err("ReqlQueryLogicError", "Lower bound (0) is not less than upper bound (0).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (0) is not less than upper bound (0).") /* r.random(0) */ suite.T().Log("About to run line #165: r.Random(0)") runAndAssert(suite.Suite, expected_, r.Random(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #165") } { // random.yaml line #167 /* err("ReqlQueryLogicError", "Lower bound (0) is not less than upper bound (0).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (0) is not less than upper bound (0).") /* r.random(0, 0) */ suite.T().Log("About to run line #167: r.Random(0, 0)") runAndAssert(suite.Suite, expected_, r.Random(0, 0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #167") } { // random.yaml line #169 /* err("ReqlQueryLogicError", "Lower bound (515) is not less than upper bound (515).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (515) is not less than upper bound (515).") /* r.random(515, 515) */ suite.T().Log("About to run line #169: r.Random(515, 515)") runAndAssert(suite.Suite, expected_, r.Random(515, 515), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #169") } { // random.yaml line #171 /* err("ReqlQueryLogicError", "Lower bound (-956) is not less than upper bound (-956).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (-956) is not less than upper bound (-956).") /* r.random(-956, -956) */ suite.T().Log("About to run line #171: r.Random(-956, -956)") runAndAssert(suite.Suite, expected_, r.Random(-956, -956), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #171") } { // random.yaml line #173 /* err("ReqlQueryLogicError", "Lower bound (0) is not less than upper bound (-10).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (0) is not less than upper bound (-10).") /* r.random(-10) */ suite.T().Log("About to run line #173: r.Random(-10)") runAndAssert(suite.Suite, expected_, r.Random(-10), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #173") } { // random.yaml line #175 /* err("ReqlQueryLogicError", "Lower bound (20) is not less than upper bound (2).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (20) is not less than upper bound (2).") /* r.random(20, 2) */ suite.T().Log("About to run line #175: r.Random(20, 2)") runAndAssert(suite.Suite, expected_, r.Random(20, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #175") } { // random.yaml line #177 /* err("ReqlQueryLogicError", "Lower bound (2) is not less than upper bound (-20).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (2) is not less than upper bound (-20).") /* r.random(2, -20) */ suite.T().Log("About to run line #177: r.Random(2, -20)") runAndAssert(suite.Suite, expected_, r.Random(2, -20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #177") } { // random.yaml line #179 /* err("ReqlQueryLogicError", "Lower bound (1456) is not less than upper bound (0).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Lower bound (1456) is not less than upper bound (0).") /* r.random(1456, 0) */ suite.T().Log("About to run line #179: r.Random(1456, 0)") runAndAssert(suite.Suite, expected_, r.Random(1456, 0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #179") } }
func (suite *SelectionSuite) TestCases() { suite.T().Log("Running SelectionSuite: Tests that manipulation data in tables") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors tbl3 := r.DB("test").Table("tbl3") _ = tbl3 // Prevent any noused variable errors { // selection.yaml line #6 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} /* tbl.insert([{'id':i, 'a':i%4} for i in xrange(100)]) */ suite.T().Log("About to run line #6: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'a': r.Mod(i, 4), })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i, "a": r.Mod(i, 4)}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // selection.yaml line #18 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} /* tbl2.insert([{'id':i, 'b':i%4} for i in xrange(100)]) */ suite.T().Log("About to run line #18: tbl2.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'b': r.Mod(i, 4), })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl2.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i, "b": r.Mod(i, 4)}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // selection.yaml line #31 /* 'TABLE' */ var expected_ string = "TABLE" /* tbl.type_of() */ suite.T().Log("About to run line #31: tbl.TypeOf()") runAndAssert(suite.Suite, expected_, tbl.TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // selection.yaml line #35 /* err("ReqlOpFailedError", 'Database `missing` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Database `missing` does not exist.") /* r.db('missing').table('bar') */ suite.T().Log("About to run line #35: r.DB('missing').Table('bar')") runAndAssert(suite.Suite, expected_, r.DB("missing").Table("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // selection.yaml line #39 /* err("ReqlOpFailedError", 'Table `test.missing` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.missing` does not exist.") /* r.db('test').table('missing') */ suite.T().Log("About to run line #39: r.DB('test').Table('missing')") runAndAssert(suite.Suite, expected_, r.DB("test").Table("missing"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // selection.yaml line #43 /* ({"errors":1,"inserted":0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"errors": 1, "inserted": 0} /* tbl.insert({"id":"\x00"}).pluck("errors","inserted") */ suite.T().Log("About to run line #43: tbl.Insert(map[interface{}]interface{}{'id': '\\u0000', }).Pluck('errors', 'inserted')") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": "\u0000"}).Pluck("errors", "inserted"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // selection.yaml line #46 /* ({"errors":1,"inserted":0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"errors": 1, "inserted": 0} /* tbl.insert({"id":["embedded",["null\x00"]]}).pluck("errors","inserted") */ suite.T().Log("About to run line #46: tbl.Insert(map[interface{}]interface{}{'id': []interface{}{'embedded', []interface{}{'null\\u0000'}}, }).Pluck('errors', 'inserted')") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": []interface{}{"embedded", []interface{}{"null\u0000"}}}).Pluck("errors", "inserted"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // selection.yaml line #51 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 1} /* tbl3.insert({'id':u'Здравствуй','value':u'Земля!'}) */ suite.T().Log("About to run line #51: tbl3.Insert(map[interface{}]interface{}{'id': 'Здравствуй', 'value': 'Земля!', })") runAndAssert(suite.Suite, expected_, tbl3.Insert(map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // selection.yaml line #60 /* {u'id':u'Здравствуй',u'value':u'Земля!'} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"} /* tbl3.get('Здравствуй') */ suite.T().Log("About to run line #60: tbl3.Get('Здравствуй')") runAndAssert(suite.Suite, expected_, tbl3.Get("Здравствуй"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // selection.yaml line #73 /* [{u'id':u'Здравствуй',u'value':u'Земля!'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"}} /* tbl3.filter({'value':'Земля!'}) */ suite.T().Log("About to run line #73: tbl3.Filter(map[interface{}]interface{}{'value': 'Земля!', })") runAndAssert(suite.Suite, expected_, tbl3.Filter(map[interface{}]interface{}{"value": "Земля!"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // selection.yaml line #86 /* err("ReqlQueryLogicError", 'Database name `%` invalid (Use A-Za-z0-9_ only).', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Database name `%` invalid (Use A-Za-z0-9_ only).") /* r.db('%') */ suite.T().Log("About to run line #86: r.DB('%')") runAndAssert(suite.Suite, expected_, r.DB("%"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // selection.yaml line #89 /* err("ReqlQueryLogicError", 'Table name `%` invalid (Use A-Za-z0-9_ only).', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Table name `%` invalid (Use A-Za-z0-9_ only).") /* r.db('test').table('%') */ suite.T().Log("About to run line #89: r.DB('test').Table('%')") runAndAssert(suite.Suite, expected_, r.DB("test").Table("%"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // selection.yaml line #93 /* 100 */ var expected_ int = 100 /* tbl.count() */ suite.T().Log("About to run line #93: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } // selection.yaml line #97 // tbl2Name = tbl2.info().get_field('name') suite.T().Log("Possibly executing: var tbl2Name r.Term = tbl2.Info().Field('name')") tbl2Name := tbl2.Info().Field("name") _ = tbl2Name // Prevent any noused variable errors // selection.yaml line #98 // tbl2DbName = tbl2.info().get_field('db').get_field('name') suite.T().Log("Possibly executing: var tbl2DbName r.Term = tbl2.Info().Field('db').Field('name')") tbl2DbName := tbl2.Info().Field("db").Field("name") _ = tbl2DbName // Prevent any noused variable errors { // selection.yaml line #101 /* 100 */ var expected_ int = 100 /* r.db(tbl2DbName).table(tbl2Name, read_mode='outdated').count() */ suite.T().Log("About to run line #101: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'outdated', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "outdated"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // selection.yaml line #102 /* 100 */ var expected_ int = 100 /* r.db(tbl2DbName).table(tbl2Name, read_mode='single').count() */ suite.T().Log("About to run line #102: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'single', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "single"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #102") } { // selection.yaml line #103 /* 100 */ var expected_ int = 100 /* r.db(tbl2DbName).table(tbl2Name, read_mode='majority').count() */ suite.T().Log("About to run line #103: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'majority', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "majority"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // selection.yaml line #120 /* err("ReqlQueryLogicError", 'Expected type STRING but found BOOL.') */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found BOOL.") /* r.db(tbl2DbName).table(tbl2Name, read_mode=true).count() */ suite.T().Log("About to run line #120: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: true, }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: true}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #120") } { // selection.yaml line #125 /* err("ReqlQueryLogicError", 'Read mode `fake` unrecognized (options are "majority", "single", and "outdated").') */ var expected_ Err = err("ReqlQueryLogicError", "Read mode `fake` unrecognized (options are \"majority\", \"single\", and \"outdated\").") /* r.db(tbl2DbName).table(tbl2Name, read_mode='fake').count() */ suite.T().Log("About to run line #125: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'fake', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "fake"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // selection.yaml line #130 /* 2 */ var expected_ int = 2 /* tbl.get(20).count() */ suite.T().Log("About to run line #130: tbl.Get(20).Count()") runAndAssert(suite.Suite, expected_, tbl.Get(20).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #130") } { // selection.yaml line #134 /* {'id':20,'a':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 20, "a": 0} /* tbl.get(20) */ suite.T().Log("About to run line #134: tbl.Get(20)") runAndAssert(suite.Suite, expected_, tbl.Get(20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #134") } { // selection.yaml line #138 /* null */ var expected_ interface{} = nil /* tbl.get(2000) */ suite.T().Log("About to run line #138: tbl.Get(2000)") runAndAssert(suite.Suite, expected_, tbl.Get(2000), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #138") } // selection.yaml line #153 // tblpkey = r.db('test').table('testpkey') suite.T().Log("Possibly executing: var tblpkey r.Term = r.DB('test').Table('testpkey')") tblpkey := r.DB("test").Table("testpkey") _ = tblpkey // Prevent any noused variable errors { // selection.yaml line #149 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('testpkey', primary_key='foo') */ suite.T().Log("About to run line #149: r.DB('test').TableCreate('testpkey').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("testpkey").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #149") } { // selection.yaml line #155 /* {'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 1} /* tblpkey.insert({'foo':10,'a':10}) */ suite.T().Log("About to run line #155: tblpkey.Insert(map[interface{}]interface{}{'foo': 10, 'a': 10, })") runAndAssert(suite.Suite, expected_, tblpkey.Insert(map[interface{}]interface{}{"foo": 10, "a": 10}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #155") } { // selection.yaml line #159 /* {'foo':10,'a':10} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"foo": 10, "a": 10} /* tblpkey.get(10) */ suite.T().Log("About to run line #159: tblpkey.Get(10)") runAndAssert(suite.Suite, expected_, tblpkey.Get(10), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // selection.yaml line #163 /* [] */ var expected_ []interface{} = []interface{}{} /* tbl.get_all() */ suite.T().Log("About to run line #163: tbl.GetAll()") runAndAssert(suite.Suite, expected_, tbl.GetAll(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #163") } { // selection.yaml line #165 /* [{"id":20,"a":0}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 20, "a": 0}} /* tbl.get_all(20) */ suite.T().Log("About to run line #165: tbl.GetAll(20)") runAndAssert(suite.Suite, expected_, tbl.GetAll(20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #165") } { // selection.yaml line #167 /* "SELECTION<STREAM>" */ var expected_ string = "SELECTION<STREAM>" /* tbl.get_all().type_of() */ suite.T().Log("About to run line #167: tbl.GetAll().TypeOf()") runAndAssert(suite.Suite, expected_, tbl.GetAll().TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #167") } { // selection.yaml line #169 /* "SELECTION<STREAM>" */ var expected_ string = "SELECTION<STREAM>" /* tbl.get_all(20).type_of() */ suite.T().Log("About to run line #169: tbl.GetAll(20).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.GetAll(20).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #169") } { // selection.yaml line #173 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(2, 1).type_of() */ suite.T().Log("About to run line #173: tbl.Between(2, 1).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #173") } { // selection.yaml line #175 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(1, 2).type_of() */ suite.T().Log("About to run line #175: tbl.Between(1, 2).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(1, 2).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #175") } { // selection.yaml line #177 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(1, 2, index='id').type_of() */ suite.T().Log("About to run line #177: tbl.Between(1, 2).OptArgs(r.BetweenOpts{Index: 'id', }).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(1, 2).OptArgs(r.BetweenOpts{Index: "id"}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #177") } { // selection.yaml line #181 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(1, 1, right_bound='closed').type_of() */ suite.T().Log("About to run line #181: tbl.Between(1, 1).OptArgs(r.BetweenOpts{RightBound: 'closed', }).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(1, 1).OptArgs(r.BetweenOpts{RightBound: "closed"}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #181") } { // selection.yaml line #185 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(2, 1).type_of() */ suite.T().Log("About to run line #185: tbl.Between(2, 1).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #185") } { // selection.yaml line #187 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(2, 1, index='id').type_of() */ suite.T().Log("About to run line #187: tbl.Between(2, 1).OptArgs(r.BetweenOpts{Index: 'id', }).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).OptArgs(r.BetweenOpts{Index: "id"}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #187") } { // selection.yaml line #192 /* 0 */ var expected_ int = 0 /* tbl.between(21, 20).count() */ suite.T().Log("About to run line #192: tbl.Between(21, 20).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(21, 20).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #192") } { // selection.yaml line #194 /* 9 */ var expected_ int = 9 /* tbl.between(20, 29).count() */ suite.T().Log("About to run line #194: tbl.Between(20, 29).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #194") } { // selection.yaml line #196 /* 9 */ var expected_ int = 9 /* tbl.between(-10, 9).count() */ suite.T().Log("About to run line #196: tbl.Between(-10, 9).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #196") } { // selection.yaml line #198 /* 20 */ var expected_ int = 20 /* tbl.between(80, 2000).count() */ suite.T().Log("About to run line #198: tbl.Between(80, 2000).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #198") } { // selection.yaml line #200 /* 100 */ var expected_ int = 100 /* tbl.between(-2000, 2000).count() */ suite.T().Log("About to run line #200: tbl.Between(-2000, 2000).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #200") } { // selection.yaml line #205 /* 10 */ var expected_ int = 10 /* tbl.between(20, 29, right_bound='closed').count() */ suite.T().Log("About to run line #205: tbl.Between(20, 29).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #205") } { // selection.yaml line #209 /* 10 */ var expected_ int = 10 /* tbl.between(-10, 9, right_bound='closed').count() */ suite.T().Log("About to run line #209: tbl.Between(-10, 9).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #209") } { // selection.yaml line #213 /* 20 */ var expected_ int = 20 /* tbl.between(80, 2000, right_bound='closed').count() */ suite.T().Log("About to run line #213: tbl.Between(80, 2000).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #213") } { // selection.yaml line #217 /* 100 */ var expected_ int = 100 /* tbl.between(-2000, 2000, right_bound='closed').count() */ suite.T().Log("About to run line #217: tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #217") } { // selection.yaml line #223 /* 8 */ var expected_ int = 8 /* tbl.between(20, 29, left_bound='open').count() */ suite.T().Log("About to run line #223: tbl.Between(20, 29).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #223") } { // selection.yaml line #227 /* 9 */ var expected_ int = 9 /* tbl.between(-10, 9, left_bound='open').count() */ suite.T().Log("About to run line #227: tbl.Between(-10, 9).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #227") } { // selection.yaml line #231 /* 19 */ var expected_ int = 19 /* tbl.between(80, 2000, left_bound='open').count() */ suite.T().Log("About to run line #231: tbl.Between(80, 2000).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #231") } { // selection.yaml line #235 /* 100 */ var expected_ int = 100 /* tbl.between(-2000, 2000, left_bound='open').count() */ suite.T().Log("About to run line #235: tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #235") } { // selection.yaml line #240 /* err('ReqlQueryLogicError', 'Expected type TABLE_SLICE but found DATUM:', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type TABLE_SLICE but found DATUM:") /* r.expr([1, 2, 3]).between(-1, 2) */ suite.T().Log("About to run line #240: r.Expr([]interface{}{1, 2, 3}).Between(-1, 2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Between(-1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #240") } { // selection.yaml line #244 /* 2 */ var expected_ int = 2 /* tbl.between(r.minval, 2).count() */ suite.T().Log("About to run line #244: tbl.Between(r.MinVal, 2).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #244") } { // selection.yaml line #247 /* 3 */ var expected_ int = 3 /* tbl.between(r.minval, 2, right_bound='closed').count() */ suite.T().Log("About to run line #247: tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #247") } { // selection.yaml line #251 /* 2 */ var expected_ int = 2 /* tbl.between(r.minval, 2, left_bound='open').count() */ suite.T().Log("About to run line #251: tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #251") } { // selection.yaml line #255 /* 98 */ var expected_ int = 98 /* tbl.between(2, r.maxval).count() */ suite.T().Log("About to run line #255: tbl.Between(2, r.MaxVal).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(2, r.MaxVal).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #255") } { // selection.yaml line #265 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") /* tbl.between(null, 2).count() */ suite.T().Log("About to run line #265: tbl.Between(nil, 2).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(nil, 2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #265") } { // selection.yaml line #266 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") /* tbl.between(2, null).count() */ suite.T().Log("About to run line #266: tbl.Between(2, nil).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(2, nil).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #266") } { // selection.yaml line #267 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") /* tbl.between(null, null).count() */ suite.T().Log("About to run line #267: tbl.Between(nil, nil).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(nil, nil).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #267") } { // selection.yaml line #271 /* 1 */ var expected_ int = 1 /* tblpkey.between(9, 11).count() */ suite.T().Log("About to run line #271: tblpkey.Between(9, 11).Count()") runAndAssert(suite.Suite, expected_, tblpkey.Between(9, 11).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #271") } { // selection.yaml line #274 /* 0 */ var expected_ int = 0 /* tblpkey.between(11, 12).count() */ suite.T().Log("About to run line #274: tblpkey.Between(11, 12).Count()") runAndAssert(suite.Suite, expected_, tblpkey.Between(11, 12).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #274") } { // selection.yaml line #278 /* 25 */ var expected_ int = 25 /* tbl.filter(lambda row:row['a'] > 2).count() */ suite.T().Log("About to run line #278: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Gt(2)}).Count()") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Gt(2) }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #278") } { // selection.yaml line #284 /* 100 */ var expected_ int = 100 /* tbl.filter(lambda row: 1).count() */ suite.T().Log("About to run line #284: tbl.Filter(func(row r.Term) interface{} { return 1}).Count()") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return 1 }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #284") } { // selection.yaml line #290 /* [4, 5] */ var expected_ []interface{} = []interface{}{4, 5} /* r.expr([1, 2, 3, 4, 5]).filter(r.row > 2).filter(r.row > 3) */ suite.T().Log("About to run line #290: r.Expr([]interface{}{1, 2, 3, 4, 5}).Filter(r.Row.Gt(2)).Filter(r.Row.Gt(3))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4, 5}).Filter(r.Row.Gt(2)).Filter(r.Row.Gt(3)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #290") } // selection.yaml line #296 // nested = r.expr([[1, 2], [3, 4], [5, 6]]) suite.T().Log("Possibly executing: var nested r.Term = r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}})") nested := r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}}) _ = nested // Prevent any noused variable errors { // selection.yaml line #298 /* [[3, 4], [5, 6]] */ var expected_ []interface{} = []interface{}{[]interface{}{3, 4}, []interface{}{5, 6}} /* nested.filter(lambda x: x.filter(lambda y: y >= 4).count() > 0) */ suite.T().Log("About to run line #298: nested.Filter(func(x r.Term) interface{} { return x.Filter(func(y r.Term) interface{} { return r.Ge(y, 4)}).Count().Gt(0)})") runAndAssert(suite.Suite, expected_, nested.Filter(func(x r.Term) interface{} { return x.Filter(func(y r.Term) interface{} { return r.Ge(y, 4) }).Count().Gt(0) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #298") } { // selection.yaml line #303 /* ([[3, 4], [5, 6]]) */ var expected_ []interface{} = []interface{}{[]interface{}{3, 4}, []interface{}{5, 6}} /* nested.filter(r.row.filter(lambda y: y >= 4).count() > 0) */ suite.T().Log("About to run line #303: nested.Filter(r.Row.Filter(func(y r.Term) interface{} { return r.Ge(y, 4)}).Count().Gt(0))") runAndAssert(suite.Suite, expected_, nested.Filter(r.Row.Filter(func(y r.Term) interface{} { return r.Ge(y, 4) }).Count().Gt(0)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #303") } { // selection.yaml line #307 /* err("ReqlCompileError", 'Cannot use r.row in nested queries. Use functions instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot use r.row in nested queries. Use functions instead.") /* nested.filter(lambda x: x.filter(r.row >= 4).count() > 0) */ suite.T().Log("About to run line #307: nested.Filter(func(x r.Term) interface{} { return x.Filter(r.Row.Ge(4)).Count().Gt(0)})") runAndAssert(suite.Suite, expected_, nested.Filter(func(x r.Term) interface{} { return x.Filter(r.Row.Ge(4)).Count().Gt(0) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #307") } { // selection.yaml line #311 /* err("ReqlCompileError", 'Cannot use r.row in nested queries. Use functions instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot use r.row in nested queries. Use functions instead.") /* r.expr([[1, 2], [3, 4], [5, 6]]).filter(r.row.filter(r.row >= 4).count() > 0) */ suite.T().Log("About to run line #311: r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}}).Filter(r.Row.Filter(r.Row.Ge(4)).Count().Gt(0))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}}).Filter(r.Row.Filter(r.Row.Ge(4)).Count().Gt(0)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #311") } { // selection.yaml line #316 /* [{'a':1,'b':2,'c':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}} /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':1,'b':2}) */ suite.T().Log("About to run line #316: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 1, 'c': 3, }, map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 3, }}).Filter(map[interface{}]interface{}{'a': 1, 'b': 2, })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}}).Filter(map[interface{}]interface{}{"a": 1, "b": 2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #316") } { // selection.yaml line #319 /* [{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}} /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':1}) */ suite.T().Log("About to run line #319: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 1, 'c': 3, }, map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 3, }}).Filter(map[interface{}]interface{}{'a': 1, })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}}).Filter(map[interface{}]interface{}{"a": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #319") } { // selection.yaml line #323 /* [{'a':1,'b':1,'c':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}} /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':r.row['b']}) */ suite.T().Log("About to run line #323: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 1, 'c': 3, }, map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 3, }}).Filter(map[interface{}]interface{}{'a': r.Row.AtIndex('b'), })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}}).Filter(map[interface{}]interface{}{"a": r.Row.AtIndex("b")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #323") } { // selection.yaml line #329 /* [] */ var expected_ []interface{} = []interface{}{} /* r.expr([{'a':1}]).filter({'b':1}) */ suite.T().Log("About to run line #329: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }}).Filter(map[interface{}]interface{}{'b': 1, })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}}).Filter(map[interface{}]interface{}{"b": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #329") } { // selection.yaml line #335 /* 25 */ var expected_ int = 25 /* tbl.count(lambda row: {'a':1}) */ suite.T().Log("About to run line #335: tbl.Count(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': 1, }})") runAndAssert(suite.Suite, expected_, tbl.Count(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": 1} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #335") } { // selection.yaml line #341 /* 2 */ var expected_ int = 2 /* r.expr([1,2,3,1]).count(1) */ suite.T().Log("About to run line #341: r.Expr([]interface{}{1, 2, 3, 1}).Count(1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 1}).Count(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #341") } { // selection.yaml line #344 /* 2 */ var expected_ int = 2 /* r.expr([null, 4, null, 'foo']).count(null) */ suite.T().Log("About to run line #344: r.Expr([]interface{}{nil, 4, nil, 'foo'}).Count(nil)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{nil, 4, nil, "foo"}).Count(nil), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #344") } { // selection.yaml line #348 /* err('ReqlQueryLogicError', 'Expected type DATUM but found TABLE:', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:") /* r.expr(5) + tbl */ suite.T().Log("About to run line #348: r.Expr(5).Add(tbl)") runAndAssert(suite.Suite, expected_, r.Expr(5).Add(tbl), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #348") } { // selection.yaml line #353 /* "SELECTION<STREAM>" */ var expected_ string = "SELECTION<STREAM>" /* tbl.has_fields('field').type_of() */ suite.T().Log("About to run line #353: tbl.HasFields('field').TypeOf()") runAndAssert(suite.Suite, expected_, tbl.HasFields("field").TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #353") } }
func (suite *MathLogicFloorCeilRoundSuite) TestCases() { suite.T().Log("Running MathLogicFloorCeilRoundSuite: tests for `floor`, `ceil`, and `round`, tests inspired by the Python test suite") { // math_logic/floor_ceil_round.yaml line #3 /* "NUMBER" */ var expected_ string = "NUMBER" /* r.floor(1.0).type_of() */ suite.T().Log("About to run line #3: r.Floor(1.0).TypeOf()") runAndAssert(suite.Suite, expected_, r.Floor(1.0).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #3") } { // math_logic/floor_ceil_round.yaml line #5 /* 1.0 */ var expected_ float64 = 1.0 /* r.floor(1.0) */ suite.T().Log("About to run line #5: r.Floor(1.0)") runAndAssert(suite.Suite, expected_, r.Floor(1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // math_logic/floor_ceil_round.yaml line #7 /* 1.0 */ var expected_ float64 = 1.0 /* r.expr(1.0).floor() */ suite.T().Log("About to run line #7: r.Expr(1.0).Floor()") runAndAssert(suite.Suite, expected_, r.Expr(1.0).Floor(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // math_logic/floor_ceil_round.yaml line #10 /* 0.0 */ var expected_ float64 = 0.0 /* r.floor(0.5) */ suite.T().Log("About to run line #10: r.Floor(0.5)") runAndAssert(suite.Suite, expected_, r.Floor(0.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // math_logic/floor_ceil_round.yaml line #12 /* 1.0 */ var expected_ float64 = 1.0 /* r.floor(1.0) */ suite.T().Log("About to run line #12: r.Floor(1.0)") runAndAssert(suite.Suite, expected_, r.Floor(1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // math_logic/floor_ceil_round.yaml line #14 /* 1.0 */ var expected_ float64 = 1.0 /* r.floor(1.5) */ suite.T().Log("About to run line #14: r.Floor(1.5)") runAndAssert(suite.Suite, expected_, r.Floor(1.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // math_logic/floor_ceil_round.yaml line #16 /* -1.0 */ var expected_ float64 = -1.0 /* r.floor(-0.5) */ suite.T().Log("About to run line #16: r.Floor(-0.5)") runAndAssert(suite.Suite, expected_, r.Floor(-0.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // math_logic/floor_ceil_round.yaml line #18 /* -1.0 */ var expected_ float64 = -1.0 /* r.floor(-1.0) */ suite.T().Log("About to run line #18: r.Floor(-1.0)") runAndAssert(suite.Suite, expected_, r.Floor(-1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // math_logic/floor_ceil_round.yaml line #20 /* -2.0 */ var expected_ float64 = -2.0 /* r.floor(-1.5) */ suite.T().Log("About to run line #20: r.Floor(-1.5)") runAndAssert(suite.Suite, expected_, r.Floor(-1.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // math_logic/floor_ceil_round.yaml line #23 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('X').floor() */ suite.T().Log("About to run line #23: r.Expr('X').Floor()") runAndAssert(suite.Suite, expected_, r.Expr("X").Floor(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // math_logic/floor_ceil_round.yaml line #27 /* "NUMBER" */ var expected_ string = "NUMBER" /* r.ceil(1.0).type_of() */ suite.T().Log("About to run line #27: r.Ceil(1.0).TypeOf()") runAndAssert(suite.Suite, expected_, r.Ceil(1.0).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // math_logic/floor_ceil_round.yaml line #29 /* 1.0 */ var expected_ float64 = 1.0 /* r.ceil(1.0) */ suite.T().Log("About to run line #29: r.Ceil(1.0)") runAndAssert(suite.Suite, expected_, r.Ceil(1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // math_logic/floor_ceil_round.yaml line #31 /* 1.0 */ var expected_ float64 = 1.0 /* r.expr(1.0).ceil() */ suite.T().Log("About to run line #31: r.Expr(1.0).Ceil()") runAndAssert(suite.Suite, expected_, r.Expr(1.0).Ceil(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // math_logic/floor_ceil_round.yaml line #34 /* 1.0 */ var expected_ float64 = 1.0 /* r.ceil(0.5) */ suite.T().Log("About to run line #34: r.Ceil(0.5)") runAndAssert(suite.Suite, expected_, r.Ceil(0.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // math_logic/floor_ceil_round.yaml line #36 /* 1.0 */ var expected_ float64 = 1.0 /* r.ceil(1.0) */ suite.T().Log("About to run line #36: r.Ceil(1.0)") runAndAssert(suite.Suite, expected_, r.Ceil(1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // math_logic/floor_ceil_round.yaml line #38 /* 2.0 */ var expected_ float64 = 2.0 /* r.ceil(1.5) */ suite.T().Log("About to run line #38: r.Ceil(1.5)") runAndAssert(suite.Suite, expected_, r.Ceil(1.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // math_logic/floor_ceil_round.yaml line #40 /* 0.0 */ var expected_ float64 = 0.0 /* r.ceil(-0.5) */ suite.T().Log("About to run line #40: r.Ceil(-0.5)") runAndAssert(suite.Suite, expected_, r.Ceil(-0.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // math_logic/floor_ceil_round.yaml line #42 /* -1.0 */ var expected_ float64 = -1.0 /* r.ceil(-1.0) */ suite.T().Log("About to run line #42: r.Ceil(-1.0)") runAndAssert(suite.Suite, expected_, r.Ceil(-1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // math_logic/floor_ceil_round.yaml line #44 /* -1.0 */ var expected_ float64 = -1.0 /* r.ceil(-1.5) */ suite.T().Log("About to run line #44: r.Ceil(-1.5)") runAndAssert(suite.Suite, expected_, r.Ceil(-1.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // math_logic/floor_ceil_round.yaml line #47 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('X').ceil() */ suite.T().Log("About to run line #47: r.Expr('X').Ceil()") runAndAssert(suite.Suite, expected_, r.Expr("X").Ceil(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // math_logic/floor_ceil_round.yaml line #51 /* "NUMBER" */ var expected_ string = "NUMBER" /* r.round(1.0).type_of() */ suite.T().Log("About to run line #51: r.Round(1.0).TypeOf()") runAndAssert(suite.Suite, expected_, r.Round(1.0).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // math_logic/floor_ceil_round.yaml line #53 /* 1.0 */ var expected_ float64 = 1.0 /* r.round(1.0) */ suite.T().Log("About to run line #53: r.Round(1.0)") runAndAssert(suite.Suite, expected_, r.Round(1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // math_logic/floor_ceil_round.yaml line #55 /* 1.0 */ var expected_ float64 = 1.0 /* r.expr(1.0).round() */ suite.T().Log("About to run line #55: r.Expr(1.0).Round()") runAndAssert(suite.Suite, expected_, r.Expr(1.0).Round(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // math_logic/floor_ceil_round.yaml line #58 /* 1.0 */ var expected_ float64 = 1.0 /* r.round(0.5) */ suite.T().Log("About to run line #58: r.Round(0.5)") runAndAssert(suite.Suite, expected_, r.Round(0.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // math_logic/floor_ceil_round.yaml line #60 /* -1.0 */ var expected_ float64 = -1.0 /* r.round(-0.5) */ suite.T().Log("About to run line #60: r.Round(-0.5)") runAndAssert(suite.Suite, expected_, r.Round(-0.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // math_logic/floor_ceil_round.yaml line #63 /* 0.0 */ var expected_ float64 = 0.0 /* r.round(0.0) */ suite.T().Log("About to run line #63: r.Round(0.0)") runAndAssert(suite.Suite, expected_, r.Round(0.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // math_logic/floor_ceil_round.yaml line #65 /* 1.0 */ var expected_ float64 = 1.0 /* r.round(1.0) */ suite.T().Log("About to run line #65: r.Round(1.0)") runAndAssert(suite.Suite, expected_, r.Round(1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // math_logic/floor_ceil_round.yaml line #67 /* 10.0 */ var expected_ float64 = 10.0 /* r.round(10.0) */ suite.T().Log("About to run line #67: r.Round(10.0)") runAndAssert(suite.Suite, expected_, r.Round(10.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #67") } { // math_logic/floor_ceil_round.yaml line #69 /* 1000000000.0 */ var expected_ float64 = 1000000000.0 /* r.round(1000000000.0) */ suite.T().Log("About to run line #69: r.Round(1000000000.0)") runAndAssert(suite.Suite, expected_, r.Round(1000000000.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } { // math_logic/floor_ceil_round.yaml line #71 /* 1e20 */ var expected_ float64 = 1e+20 /* r.round(1e20) */ suite.T().Log("About to run line #71: r.Round(1e+20)") runAndAssert(suite.Suite, expected_, r.Round(1e+20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // math_logic/floor_ceil_round.yaml line #74 /* -1.0 */ var expected_ float64 = -1.0 /* r.round(-1.0) */ suite.T().Log("About to run line #74: r.Round(-1.0)") runAndAssert(suite.Suite, expected_, r.Round(-1.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // math_logic/floor_ceil_round.yaml line #76 /* -10.0 */ var expected_ float64 = -10.0 /* r.round(-10.0) */ suite.T().Log("About to run line #76: r.Round(-10.0)") runAndAssert(suite.Suite, expected_, r.Round(-10.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #76") } { // math_logic/floor_ceil_round.yaml line #78 /* -1000000000.0 */ var expected_ float64 = -1000000000.0 /* r.round(-1000000000.0) */ suite.T().Log("About to run line #78: r.Round(-1000000000.0)") runAndAssert(suite.Suite, expected_, r.Round(-1000000000.0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // math_logic/floor_ceil_round.yaml line #80 /* -1e20 */ var expected_ float64 = -1e+20 /* r.round(-1e20) */ suite.T().Log("About to run line #80: r.Round(-1e+20)") runAndAssert(suite.Suite, expected_, r.Round(-1e+20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #80") } { // math_logic/floor_ceil_round.yaml line #83 /* 0.0 */ var expected_ float64 = 0.0 /* r.round(0.1) */ suite.T().Log("About to run line #83: r.Round(0.1)") runAndAssert(suite.Suite, expected_, r.Round(0.1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } { // math_logic/floor_ceil_round.yaml line #85 /* 1.0 */ var expected_ float64 = 1.0 /* r.round(1.1) */ suite.T().Log("About to run line #85: r.Round(1.1)") runAndAssert(suite.Suite, expected_, r.Round(1.1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } { // math_logic/floor_ceil_round.yaml line #87 /* 10.0 */ var expected_ float64 = 10.0 /* r.round(10.1) */ suite.T().Log("About to run line #87: r.Round(10.1)") runAndAssert(suite.Suite, expected_, r.Round(10.1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #87") } { // math_logic/floor_ceil_round.yaml line #89 /* 1000000000.0 */ var expected_ float64 = 1000000000.0 /* r.round(1000000000.1) */ suite.T().Log("About to run line #89: r.Round(1000000000.1)") runAndAssert(suite.Suite, expected_, r.Round(1000000000.1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // math_logic/floor_ceil_round.yaml line #92 /* -1.0 */ var expected_ float64 = -1.0 /* r.round(-1.1) */ suite.T().Log("About to run line #92: r.Round(-1.1)") runAndAssert(suite.Suite, expected_, r.Round(-1.1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } { // math_logic/floor_ceil_round.yaml line #94 /* -10.0 */ var expected_ float64 = -10.0 /* r.round(-10.1) */ suite.T().Log("About to run line #94: r.Round(-10.1)") runAndAssert(suite.Suite, expected_, r.Round(-10.1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #94") } { // math_logic/floor_ceil_round.yaml line #96 /* -1000000000.0 */ var expected_ float64 = -1000000000.0 /* r.round(-1000000000.1) */ suite.T().Log("About to run line #96: r.Round(-1000000000.1)") runAndAssert(suite.Suite, expected_, r.Round(-1000000000.1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #96") } { // math_logic/floor_ceil_round.yaml line #99 /* 1.0 */ var expected_ float64 = 1.0 /* r.round(0.9) */ suite.T().Log("About to run line #99: r.Round(0.9)") runAndAssert(suite.Suite, expected_, r.Round(0.9), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // math_logic/floor_ceil_round.yaml line #101 /* 10.0 */ var expected_ float64 = 10.0 /* r.round(9.9) */ suite.T().Log("About to run line #101: r.Round(9.9)") runAndAssert(suite.Suite, expected_, r.Round(9.9), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // math_logic/floor_ceil_round.yaml line #103 /* 1000000000.0 */ var expected_ float64 = 1000000000.0 /* r.round(999999999.9) */ suite.T().Log("About to run line #103: r.Round(999999999.9)") runAndAssert(suite.Suite, expected_, r.Round(999999999.9), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // math_logic/floor_ceil_round.yaml line #106 /* -1.0 */ var expected_ float64 = -1.0 /* r.round(-0.9) */ suite.T().Log("About to run line #106: r.Round(-0.9)") runAndAssert(suite.Suite, expected_, r.Round(-0.9), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #106") } { // math_logic/floor_ceil_round.yaml line #108 /* -10.0 */ var expected_ float64 = -10.0 /* r.round(-9.9) */ suite.T().Log("About to run line #108: r.Round(-9.9)") runAndAssert(suite.Suite, expected_, r.Round(-9.9), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // math_logic/floor_ceil_round.yaml line #110 /* -1000000000.0 */ var expected_ float64 = -1000000000.0 /* r.round(-999999999.9) */ suite.T().Log("About to run line #110: r.Round(-999999999.9)") runAndAssert(suite.Suite, expected_, r.Round(-999999999.9), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #110") } { // math_logic/floor_ceil_round.yaml line #113 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('X').round() */ suite.T().Log("About to run line #113: r.Expr('X').Round()") runAndAssert(suite.Suite, expected_, r.Expr("X").Round(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } }
func (suite *MathLogicSubSuite) TestCases() { suite.T().Log("Running MathLogicSubSuite: Tests for basic usage of the subtraction operation") { // math_logic/sub.yaml line #6 /* 0 */ var expected_ int = 0 /* r.expr(1) - 1 */ suite.T().Log("About to run line #6: r.Expr(1).Sub(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Sub(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // math_logic/sub.yaml line #7 /* 0 */ var expected_ int = 0 /* 1 - r.expr(1) */ suite.T().Log("About to run line #7: r.Sub(1, r.Expr(1))") runAndAssert(suite.Suite, expected_, r.Sub(1, r.Expr(1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // math_logic/sub.yaml line #8 /* 0 */ var expected_ int = 0 /* r.expr(1).sub(1) */ suite.T().Log("About to run line #8: r.Expr(1).Sub(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Sub(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // math_logic/sub.yaml line #17 /* -2 */ var expected_ int = -2 /* r.expr(-1) - 1 */ suite.T().Log("About to run line #17: r.Expr(-1).Sub(1)") runAndAssert(suite.Suite, expected_, r.Expr(-1).Sub(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // math_logic/sub.yaml line #22 /* -6.75 */ var expected_ float64 = -6.75 /* r.expr(1.75) - 8.5 */ suite.T().Log("About to run line #22: r.Expr(1.75).Sub(8.5)") runAndAssert(suite.Suite, expected_, r.Expr(1.75).Sub(8.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // math_logic/sub.yaml line #26 /* -13 */ var expected_ int = -13 /* r.expr(1).sub(2,3,4,5) */ suite.T().Log("About to run line #26: r.Expr(1).Sub(2, 3, 4, 5)") runAndAssert(suite.Suite, expected_, r.Expr(1).Sub(2, 3, 4, 5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // math_logic/sub.yaml line #30 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('a').sub(0.8) */ suite.T().Log("About to run line #30: r.Expr('a').Sub(0.8)") runAndAssert(suite.Suite, expected_, r.Expr("a").Sub(0.8), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // math_logic/sub.yaml line #33 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [1]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr(1).sub('a') */ suite.T().Log("About to run line #33: r.Expr(1).Sub('a')") runAndAssert(suite.Suite, expected_, r.Expr(1).Sub("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #33") } { // math_logic/sub.yaml line #36 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('b').sub('a') */ suite.T().Log("About to run line #36: r.Expr('b').Sub('a')") runAndAssert(suite.Suite, expected_, r.Expr("b").Sub("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } }
func (suite *DatumArraySuite) TestCases() { suite.T().Log("Running DatumArraySuite: Tests conversion to and from the RQL array type") { // datum/array.yaml line #6 /* [] */ var expected_ []interface{} = []interface{}{} /* r.expr([]) */ suite.T().Log("About to run line #6: r.Expr([]interface{}{})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // datum/array.yaml line #9 /* [1] */ var expected_ []interface{} = []interface{}{1} /* r.expr([1]) */ suite.T().Log("About to run line #9: r.Expr([]interface{}{1})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // datum/array.yaml line #14 /* [1,2,3,4,5] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4, 5} /* r.expr([1,2,3,4,5]) */ suite.T().Log("About to run line #14: r.Expr([]interface{}{1, 2, 3, 4, 5})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4, 5}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // datum/array.yaml line #19 /* 'ARRAY' */ var expected_ string = "ARRAY" /* r.expr([]).type_of() */ suite.T().Log("About to run line #19: r.Expr([]interface{}{}).TypeOf()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // datum/array.yaml line #24 /* '[1,2]' */ var expected_ string = "[1,2]" /* r.expr([1, 2]).coerce_to('string') */ suite.T().Log("About to run line #24: r.Expr([]interface{}{1, 2}).CoerceTo('string')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).CoerceTo("string"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // datum/array.yaml line #25 /* '[1,2]' */ var expected_ string = "[1,2]" /* r.expr([1, 2]).coerce_to('STRING') */ suite.T().Log("About to run line #25: r.Expr([]interface{}{1, 2}).CoerceTo('STRING')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).CoerceTo("STRING"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // datum/array.yaml line #28 /* [1, 2] */ var expected_ []interface{} = []interface{}{1, 2} /* r.expr([1, 2]).coerce_to('array') */ suite.T().Log("About to run line #28: r.Expr([]interface{}{1, 2}).CoerceTo('array')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).CoerceTo("array"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // datum/array.yaml line #31 /* err('ReqlQueryLogicError', 'Cannot coerce ARRAY to NUMBER.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot coerce ARRAY to NUMBER.") /* r.expr([1, 2]).coerce_to('number') */ suite.T().Log("About to run line #31: r.Expr([]interface{}{1, 2}).CoerceTo('number')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).CoerceTo("number"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // datum/array.yaml line #34 /* {'a':1,'b':2} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2} /* r.expr([['a', 1], ['b', 2]]).coerce_to('object') */ suite.T().Log("About to run line #34: r.Expr([]interface{}{[]interface{}{'a', 1}, []interface{}{'b', 2}}).CoerceTo('object')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{[]interface{}{"a", 1}, []interface{}{"b", 2}}).CoerceTo("object"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // datum/array.yaml line #37 /* err('ReqlQueryLogicError', 'Expected array of size 2, but got size 0.') */ var expected_ Err = err("ReqlQueryLogicError", "Expected array of size 2, but got size 0.") /* r.expr([[]]).coerce_to('object') */ suite.T().Log("About to run line #37: r.Expr([]interface{}{[]interface{}{}}).CoerceTo('object')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{[]interface{}{}}).CoerceTo("object"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // datum/array.yaml line #40 /* err('ReqlQueryLogicError', 'Expected array of size 2, but got size 3.') */ var expected_ Err = err("ReqlQueryLogicError", "Expected array of size 2, but got size 3.") /* r.expr([['1',2,3]]).coerce_to('object') */ suite.T().Log("About to run line #40: r.Expr([]interface{}{[]interface{}{'1', 2, 3}}).CoerceTo('object')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{[]interface{}{"1", 2, 3}}).CoerceTo("object"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // datum/array.yaml line #44 /* [1] */ var expected_ []interface{} = []interface{}{1} /* r.expr([r.expr(1)]) */ suite.T().Log("About to run line #44: r.Expr([]interface{}{r.Expr(1)})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Expr(1)}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // datum/array.yaml line #47 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,3,4]).insert_at(1, 2) */ suite.T().Log("About to run line #47: r.Expr([]interface{}{1, 3, 4}).InsertAt(1, 2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 3, 4}).InsertAt(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // datum/array.yaml line #49 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.expr([2,3]).insert_at(0, 1) */ suite.T().Log("About to run line #49: r.Expr([]interface{}{2, 3}).InsertAt(0, 1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{2, 3}).InsertAt(0, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // datum/array.yaml line #51 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,2,3]).insert_at(-1, 4) */ suite.T().Log("About to run line #51: r.Expr([]interface{}{1, 2, 3}).InsertAt(-1, 4)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).InsertAt(-1, 4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // datum/array.yaml line #53 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,2,3]).insert_at(3, 4) */ suite.T().Log("About to run line #53: r.Expr([]interface{}{1, 2, 3}).InsertAt(3, 4)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).InsertAt(3, 4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // datum/array.yaml line #55 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* r.expr(3).do(lambda x: r.expr([1,2,3]).insert_at(x, 4)) */ suite.T().Log("About to run line #55: r.Expr(3).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3}).InsertAt(x, 4)})") runAndAssert(suite.Suite, expected_, r.Expr(3).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3}).InsertAt(x, 4) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // datum/array.yaml line #59 /* err('ReqlNonExistenceError', 'Index `4` out of bounds for array of size: `3`.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index `4` out of bounds for array of size: `3`.") /* r.expr([1,2,3]).insert_at(4, 5) */ suite.T().Log("About to run line #59: r.Expr([]interface{}{1, 2, 3}).InsertAt(4, 5)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).InsertAt(4, 5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // datum/array.yaml line #61 /* err('ReqlNonExistenceError', 'Index out of bounds: -5', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index out of bounds: -5") /* r.expr([1,2,3]).insert_at(-5, -1) */ suite.T().Log("About to run line #61: r.Expr([]interface{}{1, 2, 3}).InsertAt(-5, -1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).InsertAt(-5, -1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #61") } { // datum/array.yaml line #63 /* err('ReqlQueryLogicError', 'Number not an integer: 1.5', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Number not an integer: 1.5") /* r.expr([1,2,3]).insert_at(1.5, 1) */ suite.T().Log("About to run line #63: r.Expr([]interface{}{1, 2, 3}).InsertAt(1.5, 1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).InsertAt(1.5, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // datum/array.yaml line #65 /* err('ReqlNonExistenceError', 'Expected type NUMBER but found NULL.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* r.expr([1,2,3]).insert_at(null, 1) */ suite.T().Log("About to run line #65: r.Expr([]interface{}{1, 2, 3}).InsertAt(nil, 1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).InsertAt(nil, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // datum/array.yaml line #68 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,4]).splice_at(1, [2,3]) */ suite.T().Log("About to run line #68: r.Expr([]interface{}{1, 4}).SpliceAt(1, []interface{}{2, 3})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 4}).SpliceAt(1, []interface{}{2, 3}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // datum/array.yaml line #70 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([3,4]).splice_at(0, [1,2]) */ suite.T().Log("About to run line #70: r.Expr([]interface{}{3, 4}).SpliceAt(0, []interface{}{1, 2})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{3, 4}).SpliceAt(0, []interface{}{1, 2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // datum/array.yaml line #72 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,2]).splice_at(2, [3,4]) */ suite.T().Log("About to run line #72: r.Expr([]interface{}{1, 2}).SpliceAt(2, []interface{}{3, 4})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).SpliceAt(2, []interface{}{3, 4}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #72") } { // datum/array.yaml line #74 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,2]).splice_at(-1, [3,4]) */ suite.T().Log("About to run line #74: r.Expr([]interface{}{1, 2}).SpliceAt(-1, []interface{}{3, 4})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).SpliceAt(-1, []interface{}{3, 4}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // datum/array.yaml line #76 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* r.expr(2).do(lambda x: r.expr([1,2]).splice_at(x, [3,4])) */ suite.T().Log("About to run line #76: r.Expr(2).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{1, 2}).SpliceAt(x, []interface{}{3, 4})})") runAndAssert(suite.Suite, expected_, r.Expr(2).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{1, 2}).SpliceAt(x, []interface{}{3, 4}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #76") } { // datum/array.yaml line #80 /* err('ReqlNonExistenceError', 'Index `3` out of bounds for array of size: `2`.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index `3` out of bounds for array of size: `2`.") /* r.expr([1,2]).splice_at(3, [3,4]) */ suite.T().Log("About to run line #80: r.Expr([]interface{}{1, 2}).SpliceAt(3, []interface{}{3, 4})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).SpliceAt(3, []interface{}{3, 4}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #80") } { // datum/array.yaml line #82 /* err('ReqlNonExistenceError', 'Index out of bounds: -4', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index out of bounds: -4") /* r.expr([1,2]).splice_at(-4, [3,4]) */ suite.T().Log("About to run line #82: r.Expr([]interface{}{1, 2}).SpliceAt(-4, []interface{}{3, 4})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).SpliceAt(-4, []interface{}{3, 4}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #82") } { // datum/array.yaml line #84 /* err('ReqlQueryLogicError', 'Number not an integer: 1.5', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Number not an integer: 1.5") /* r.expr([1,2,3]).splice_at(1.5, [1]) */ suite.T().Log("About to run line #84: r.Expr([]interface{}{1, 2, 3}).SpliceAt(1.5, []interface{}{1})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).SpliceAt(1.5, []interface{}{1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #84") } { // datum/array.yaml line #86 /* err('ReqlNonExistenceError', 'Expected type NUMBER but found NULL.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* r.expr([1,2,3]).splice_at(null, [1]) */ suite.T().Log("About to run line #86: r.Expr([]interface{}{1, 2, 3}).SpliceAt(nil, []interface{}{1})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).SpliceAt(nil, []interface{}{1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // datum/array.yaml line #88 /* err('ReqlQueryLogicError', 'Expected type ARRAY but found NUMBER.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type ARRAY but found NUMBER.") /* r.expr([1,4]).splice_at(1, 2) */ suite.T().Log("About to run line #88: r.Expr([]interface{}{1, 4}).SpliceAt(1, 2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 4}).SpliceAt(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #88") } { // datum/array.yaml line #91 /* [2,3,4] */ var expected_ []interface{} = []interface{}{2, 3, 4} /* r.expr([1,2,3,4]).delete_at(0) */ suite.T().Log("About to run line #91: r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(0)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #91") } { // datum/array.yaml line #93 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* r.expr(0).do(lambda x: r.expr([1,2,3,4]).delete_at(x)) */ suite.T().Log("About to run line #93: r.Expr(0).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(x)})") runAndAssert(suite.Suite, expected_, r.Expr(0).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(x) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } { // datum/array.yaml line #97 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.expr([1,2,3,4]).delete_at(-1) */ suite.T().Log("About to run line #97: r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(-1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(-1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #97") } { // datum/array.yaml line #99 /* [1,4] */ var expected_ []interface{} = []interface{}{1, 4} /* r.expr([1,2,3,4]).delete_at(1,3) */ suite.T().Log("About to run line #99: r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(1, 3)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(1, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // datum/array.yaml line #101 /* [1,2,3,4] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4} /* r.expr([1,2,3,4]).delete_at(4,4) */ suite.T().Log("About to run line #101: r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(4, 4)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(4, 4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // datum/array.yaml line #103 /* [] */ var expected_ []interface{} = []interface{}{} /* r.expr([]).delete_at(0,0) */ suite.T().Log("About to run line #103: r.Expr([]interface{}{}).DeleteAt(0, 0)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).DeleteAt(0, 0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // datum/array.yaml line #105 /* [1,4] */ var expected_ []interface{} = []interface{}{1, 4} /* r.expr([1,2,3,4]).delete_at(1,-1) */ suite.T().Log("About to run line #105: r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(1, -1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(1, -1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // datum/array.yaml line #107 /* err('ReqlNonExistenceError', 'Index `4` out of bounds for array of size: `4`.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index `4` out of bounds for array of size: `4`.") /* r.expr([1,2,3,4]).delete_at(4) */ suite.T().Log("About to run line #107: r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(4)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #107") } { // datum/array.yaml line #109 /* err('ReqlNonExistenceError', 'Index out of bounds: -5', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index out of bounds: -5") /* r.expr([1,2,3,4]).delete_at(-5) */ suite.T().Log("About to run line #109: r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(-5)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).DeleteAt(-5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } { // datum/array.yaml line #111 /* err('ReqlQueryLogicError', 'Number not an integer: 1.5', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Number not an integer: 1.5") /* r.expr([1,2,3]).delete_at(1.5) */ suite.T().Log("About to run line #111: r.Expr([]interface{}{1, 2, 3}).DeleteAt(1.5)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).DeleteAt(1.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } { // datum/array.yaml line #113 /* err('ReqlNonExistenceError', 'Expected type NUMBER but found NULL.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* r.expr([1,2,3]).delete_at(null) */ suite.T().Log("About to run line #113: r.Expr([]interface{}{1, 2, 3}).DeleteAt(nil)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).DeleteAt(nil), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // datum/array.yaml line #116 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.expr([0,2,3]).change_at(0, 1) */ suite.T().Log("About to run line #116: r.Expr([]interface{}{0, 2, 3}).ChangeAt(0, 1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{0, 2, 3}).ChangeAt(0, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #116") } { // datum/array.yaml line #118 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* r.expr(1).do(lambda x: r.expr([0,2,3]).change_at(0,x)) */ suite.T().Log("About to run line #118: r.Expr(1).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{0, 2, 3}).ChangeAt(0, x)})") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{0, 2, 3}).ChangeAt(0, x) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #118") } { // datum/array.yaml line #122 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.expr([1,0,3]).change_at(1, 2) */ suite.T().Log("About to run line #122: r.Expr([]interface{}{1, 0, 3}).ChangeAt(1, 2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 0, 3}).ChangeAt(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // datum/array.yaml line #124 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.expr([1,2,0]).change_at(2, 3) */ suite.T().Log("About to run line #124: r.Expr([]interface{}{1, 2, 0}).ChangeAt(2, 3)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 0}).ChangeAt(2, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #124") } { // datum/array.yaml line #126 /* err('ReqlNonExistenceError', 'Index `3` out of bounds for array of size: `3`.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index `3` out of bounds for array of size: `3`.") /* r.expr([1,2,3]).change_at(3, 4) */ suite.T().Log("About to run line #126: r.Expr([]interface{}{1, 2, 3}).ChangeAt(3, 4)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ChangeAt(3, 4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #126") } { // datum/array.yaml line #128 /* err('ReqlNonExistenceError', 'Index out of bounds: -5', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Index out of bounds: -5") /* r.expr([1,2,3,4]).change_at(-5, 1) */ suite.T().Log("About to run line #128: r.Expr([]interface{}{1, 2, 3, 4}).ChangeAt(-5, 1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).ChangeAt(-5, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #128") } { // datum/array.yaml line #130 /* err('ReqlQueryLogicError', 'Number not an integer: 1.5', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Number not an integer: 1.5") /* r.expr([1,2,3]).change_at(1.5, 1) */ suite.T().Log("About to run line #130: r.Expr([]interface{}{1, 2, 3}).ChangeAt(1.5, 1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ChangeAt(1.5, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #130") } { // datum/array.yaml line #132 /* err('ReqlNonExistenceError', 'Expected type NUMBER but found NULL.', [0]) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* r.expr([1,2,3]).change_at(null, 1) */ suite.T().Log("About to run line #132: r.Expr([]interface{}{1, 2, 3}).ChangeAt(nil, 1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ChangeAt(nil, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } }
func (suite *TimesShimSuite) TestCases() { suite.T().Log("Running TimesShimSuite: Test the native shims.") // times/shim.yaml line #4 // t = 1375147296.68 suite.T().Log("Possibly executing: var t float64 = 1375147296.68") t := 1375147296.68 _ = t // Prevent any noused variable errors { // times/shim.yaml line #8 /* ("2013-07-29T18:21:36.680-07:00") */ var expected_ string = "2013-07-29T18:21:36.680-07:00" /* r.expr(datetime.fromtimestamp(t, PacificTimeZone())).to_iso8601() */ suite.T().Log("About to run line #8: r.Expr(Ast.Fromtimestamp(t, PacificTimeZone())).ToISO8601()") runAndAssert(suite.Suite, expected_, r.Expr(Ast.Fromtimestamp(t, PacificTimeZone())).ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // times/shim.yaml line #12 /* ("2013-07-30T01:21:36.680+00:00") */ var expected_ string = "2013-07-30T01:21:36.680+00:00" /* r.expr(datetime.fromtimestamp(t, UTCTimeZone())).to_iso8601() */ suite.T().Log("About to run line #12: r.Expr(Ast.Fromtimestamp(t, UTCTimeZone())).ToISO8601()") runAndAssert(suite.Suite, expected_, r.Expr(Ast.Fromtimestamp(t, UTCTimeZone())).ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // times/shim.yaml line #16 /* (1375147296.68) */ var expected_ float64 = 1375147296.68 /* r.expr(datetime.fromtimestamp(t, PacificTimeZone())).to_epoch_time() */ suite.T().Log("About to run line #16: r.Expr(Ast.Fromtimestamp(t, PacificTimeZone())).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Expr(Ast.Fromtimestamp(t, PacificTimeZone())).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // times/shim.yaml line #20 /* (1375147296.68) */ var expected_ float64 = 1375147296.68 /* r.expr(datetime.fromtimestamp(t, UTCTimeZone())).to_epoch_time() */ suite.T().Log("About to run line #20: r.Expr(Ast.Fromtimestamp(t, UTCTimeZone())).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Expr(Ast.Fromtimestamp(t, UTCTimeZone())).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } }
func (suite *TransformObjectSuite) TestCases() { suite.T().Log("Running TransformObjectSuite: Tests manipulation operations on objects") // transform/object.yaml line #5 // obj = r.expr({'a':1, 'b':2,'c':"str",'d':null,'e':{'f':'buzz'}}) suite.T().Log("Possibly executing: var obj r.Term = r.Expr(map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 'str', 'd': nil, 'e': map[interface{}]interface{}{'f': 'buzz', }, })") obj := r.Expr(map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}}) _ = obj // Prevent any noused variable errors { // transform/object.yaml line #9 /* 1 */ var expected_ int = 1 /* obj['a'] */ suite.T().Log("About to run line #9: obj.AtIndex('a')") runAndAssert(suite.Suite, expected_, obj.AtIndex("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // transform/object.yaml line #14 /* 'str' */ var expected_ string = "str" /* obj['c'] */ suite.T().Log("About to run line #14: obj.AtIndex('c')") runAndAssert(suite.Suite, expected_, obj.AtIndex("c"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // transform/object.yaml line #22 /* true */ var expected_ bool = true /* obj.has_fields('b') */ suite.T().Log("About to run line #22: obj.HasFields('b')") runAndAssert(suite.Suite, expected_, obj.HasFields("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // transform/object.yaml line #24 /* true */ var expected_ bool = true /* obj.keys().contains('d') */ suite.T().Log("About to run line #24: obj.Keys().Contains('d')") runAndAssert(suite.Suite, expected_, obj.Keys().Contains("d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // transform/object.yaml line #26 /* false */ var expected_ bool = false /* obj.has_fields('d') */ suite.T().Log("About to run line #26: obj.HasFields('d')") runAndAssert(suite.Suite, expected_, obj.HasFields("d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // transform/object.yaml line #28 /* true */ var expected_ bool = true /* obj.has_fields({'e':'f'}) */ suite.T().Log("About to run line #28: obj.HasFields(map[interface{}]interface{}{'e': 'f', })") runAndAssert(suite.Suite, expected_, obj.HasFields(map[interface{}]interface{}{"e": "f"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // transform/object.yaml line #30 /* false */ var expected_ bool = false /* obj.has_fields({'e':'g'}) */ suite.T().Log("About to run line #30: obj.HasFields(map[interface{}]interface{}{'e': 'g', })") runAndAssert(suite.Suite, expected_, obj.HasFields(map[interface{}]interface{}{"e": "g"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // transform/object.yaml line #32 /* false */ var expected_ bool = false /* obj.has_fields('f') */ suite.T().Log("About to run line #32: obj.HasFields('f')") runAndAssert(suite.Suite, expected_, obj.HasFields("f"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #32") } { // transform/object.yaml line #36 /* true */ var expected_ bool = true /* obj.has_fields('a', 'b') */ suite.T().Log("About to run line #36: obj.HasFields('a', 'b')") runAndAssert(suite.Suite, expected_, obj.HasFields("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // transform/object.yaml line #38 /* false */ var expected_ bool = false /* obj.has_fields('a', 'd') */ suite.T().Log("About to run line #38: obj.HasFields('a', 'd')") runAndAssert(suite.Suite, expected_, obj.HasFields("a", "d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // transform/object.yaml line #40 /* false */ var expected_ bool = false /* obj.has_fields('a', 'f') */ suite.T().Log("About to run line #40: obj.HasFields('a', 'f')") runAndAssert(suite.Suite, expected_, obj.HasFields("a", "f"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // transform/object.yaml line #42 /* true */ var expected_ bool = true /* obj.has_fields('a', {'e':'f'}) */ suite.T().Log("About to run line #42: obj.HasFields('a', map[interface{}]interface{}{'e': 'f', })") runAndAssert(suite.Suite, expected_, obj.HasFields("a", map[interface{}]interface{}{"e": "f"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // transform/object.yaml line #46 /* 2 */ var expected_ int = 2 /* r.expr([obj, obj.pluck('a', 'b')]).has_fields('a', 'b').count() */ suite.T().Log("About to run line #46: r.Expr([]interface{}{obj, obj.Pluck('a', 'b')}).HasFields('a', 'b').Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{obj, obj.Pluck("a", "b")}).HasFields("a", "b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // transform/object.yaml line #48 /* 1 */ var expected_ int = 1 /* r.expr([obj, obj.pluck('a', 'b')]).has_fields('a', 'c').count() */ suite.T().Log("About to run line #48: r.Expr([]interface{}{obj, obj.Pluck('a', 'b')}).HasFields('a', 'c').Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{obj, obj.Pluck("a", "b")}).HasFields("a", "c").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } { // transform/object.yaml line #50 /* 2 */ var expected_ int = 2 /* r.expr([obj, obj.pluck('a', 'e')]).has_fields('a', {'e':'f'}).count() */ suite.T().Log("About to run line #50: r.Expr([]interface{}{obj, obj.Pluck('a', 'e')}).HasFields('a', map[interface{}]interface{}{'e': 'f', }).Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{obj, obj.Pluck("a", "e")}).HasFields("a", map[interface{}]interface{}{"e": "f"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // transform/object.yaml line #55 /* {'a':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1} /* obj.pluck('a') */ suite.T().Log("About to run line #55: obj.Pluck('a')") runAndAssert(suite.Suite, expected_, obj.Pluck("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // transform/object.yaml line #57 /* {'a':1, 'b':2} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2} /* obj.pluck('a', 'b') */ suite.T().Log("About to run line #57: obj.Pluck('a', 'b')") runAndAssert(suite.Suite, expected_, obj.Pluck("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // transform/object.yaml line #62 /* {'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without('a') */ suite.T().Log("About to run line #62: obj.Without('a')") runAndAssert(suite.Suite, expected_, obj.Without("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } { // transform/object.yaml line #64 /* {'c':'str', 'd':null,'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without('a', 'b') */ suite.T().Log("About to run line #64: obj.Without('a', 'b')") runAndAssert(suite.Suite, expected_, obj.Without("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #64") } { // transform/object.yaml line #66 /* {'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without('a', 'b', 'c', 'd') */ suite.T().Log("About to run line #66: obj.Without('a', 'b', 'c', 'd')") runAndAssert(suite.Suite, expected_, obj.Without("a", "b", "c", "d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // transform/object.yaml line #68 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{}} /* obj.without({'e':'f'}) */ suite.T().Log("About to run line #68: obj.Without(map[interface{}]interface{}{'e': 'f', })") runAndAssert(suite.Suite, expected_, obj.Without(map[interface{}]interface{}{"e": "f"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // transform/object.yaml line #70 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without({'e':'buzz'}) */ suite.T().Log("About to run line #70: obj.Without(map[interface{}]interface{}{'e': 'buzz', })") runAndAssert(suite.Suite, expected_, obj.Without(map[interface{}]interface{}{"e": "buzz"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // transform/object.yaml line #77 /* 1 */ var expected_ int = 1 /* obj.merge(1) */ suite.T().Log("About to run line #77: obj.Merge(1)") runAndAssert(suite.Suite, expected_, obj.Merge(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #77") } { // transform/object.yaml line #81 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':-2} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": -2} /* obj.merge({'e':-2}) */ suite.T().Log("About to run line #81: obj.Merge(map[interface{}]interface{}{'e': -2, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": -2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // transform/object.yaml line #85 /* {'a':1, 'b':2, 'c':'str', 'd':null} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil} /* obj.merge({'e':r.literal()}) */ suite.T().Log("About to run line #85: obj.Merge(map[interface{}]interface{}{'e': r.Literal(), })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": r.Literal()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } { // transform/object.yaml line #89 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'quux'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "quux"}} /* obj.merge({'e':{'f':'quux'}}) */ suite.T().Log("About to run line #89: obj.Merge(map[interface{}]interface{}{'e': map[interface{}]interface{}{'f': 'quux', }, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": map[interface{}]interface{}{"f": "quux"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // transform/object.yaml line #92 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz', 'g':'quux'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz", "g": "quux"}} /* obj.merge({'e':{'g':'quux'}}) */ suite.T().Log("About to run line #92: obj.Merge(map[interface{}]interface{}{'e': map[interface{}]interface{}{'g': 'quux', }, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": map[interface{}]interface{}{"g": "quux"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } { // transform/object.yaml line #95 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'g':'quux'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"g": "quux"}} /* obj.merge({'e':r.literal({'g':'quux'})}) */ suite.T().Log("About to run line #95: obj.Merge(map[interface{}]interface{}{'e': r.Literal(map[interface{}]interface{}{'g': 'quux', }), })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": r.Literal(map[interface{}]interface{}{"g": "quux"})}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // transform/object.yaml line #99 /* {'a':-1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": -1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.merge({'a':-1}) */ suite.T().Log("About to run line #99: obj.Merge(map[interface{}]interface{}{'a': -1, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"a": -1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } // transform/object.yaml line #102 // errmsg = 'Stray literal keyword found:'+' literal is only legal inside of the object passed to merge or update and cannot nest inside other literals.' suite.T().Log("Possibly executing: var errmsg string = 'Stray literal keyword found:' + ' literal is only legal inside of the object passed to merge or update and cannot nest inside other literals.'") errmsg := "Stray literal keyword found:" + " literal is only legal inside of the object passed to merge or update and cannot nest inside other literals." _ = errmsg // Prevent any noused variable errors { // transform/object.yaml line #105 /* err("ReqlQueryLogicError", errmsg, []) */ var expected_ Err = err("ReqlQueryLogicError", errmsg) /* r.literal('foo') */ suite.T().Log("About to run line #105: r.Literal('foo')") runAndAssert(suite.Suite, expected_, r.Literal("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // transform/object.yaml line #108 /* err("ReqlQueryLogicError", errmsg, []) */ var expected_ Err = err("ReqlQueryLogicError", errmsg) /* obj.merge(r.literal('foo')) */ suite.T().Log("About to run line #108: obj.Merge(r.Literal('foo'))") runAndAssert(suite.Suite, expected_, obj.Merge(r.Literal("foo")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // transform/object.yaml line #111 /* err("ReqlQueryLogicError", errmsg, []) */ var expected_ Err = err("ReqlQueryLogicError", errmsg) /* obj.merge({'foo':r.literal(r.literal('foo'))}) */ suite.T().Log("About to run line #111: obj.Merge(map[interface{}]interface{}{'foo': r.Literal(r.Literal('foo')), })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"foo": r.Literal(r.Literal("foo"))}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } // transform/object.yaml line #114 // o = r.expr({'a':{'b':1, 'c':2}, 'd':3}) suite.T().Log("Possibly executing: var o r.Term = r.Expr(map[interface{}]interface{}{'a': map[interface{}]interface{}{'b': 1, 'c': 2, }, 'd': 3, })") o := r.Expr(map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3}) _ = o // Prevent any noused variable errors { // transform/object.yaml line #116 /* ({'a':{'b':1, 'c':2}, 'd':3, 'e':4, 'f':5}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3, "e": 4, "f": 5} /* o.merge({'e':4}, {'f':5}) */ suite.T().Log("About to run line #116: o.Merge(map[interface{}]interface{}{'e': 4, }, map[interface{}]interface{}{'f': 5, })") runAndAssert(suite.Suite, expected_, o.Merge(map[interface{}]interface{}{"e": 4}, map[interface{}]interface{}{"f": 5}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #116") } { // transform/object.yaml line #120 /* ([{'a':{'b':1, 'c':2}, 'd':3, 'e':3}, {'a':{'b':1, 'c':2}, 'd':4, 'e':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3, "e": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 4, "e": 4}} /* r.expr([o, o.merge({'d':4})]).merge(lambda row:{'e':row['d']}) */ suite.T().Log("About to run line #120: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{'e': row.AtIndex('d'), }})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{"e": row.AtIndex("d")} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #120") } { // transform/object.yaml line #124 /* ([{'a':{'b':1, 'c':2}, 'd':3, 'e':3}, {'a':{'b':1, 'c':2}, 'd':4, 'e':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3, "e": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 4, "e": 4}} /* r.expr([o, o.merge({'d':4})]).merge({'e':r.row['d']}) */ suite.T().Log("About to run line #124: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(map[interface{}]interface{}{'e': r.Row.AtIndex('d'), })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(map[interface{}]interface{}{"e": r.Row.AtIndex("d")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #124") } { // transform/object.yaml line #129 /* ([{'a':{'b':2, 'c':2}, 'd':3}, {'a':{'b':2, 'c':2}, 'd':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2, "c": 2}, "d": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2, "c": 2}, "d": 4}} /* r.expr([o, o.merge({'d':4})]).merge(lambda row:{'a':{'b':2}}) */ suite.T().Log("About to run line #129: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': map[interface{}]interface{}{'b': 2, }, }})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2}} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #129") } { // transform/object.yaml line #134 /* ([{'a':{'b':2}, 'd':3}, {'a':{'b':2}, 'd':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2}, "d": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2}, "d": 4}} /* r.expr([o, o.merge({'d':4})]).merge(lambda row:{'a':r.literal({'b':2})}) */ suite.T().Log("About to run line #134: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': r.Literal(map[interface{}]interface{}{'b': 2, }), }})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": r.Literal(map[interface{}]interface{}{"b": 2})} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #134") } { // transform/object.yaml line #139 /* (['a', 'b', 'c', 'd', 'e']) */ var expected_ []interface{} = []interface{}{"a", "b", "c", "d", "e"} /* obj.keys() */ suite.T().Log("About to run line #139: obj.Keys()") runAndAssert(suite.Suite, expected_, obj.Keys(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #139") } { // transform/object.yaml line #142 /* ([1, 2, 'str', null, {'f':'buzz'}]) */ var expected_ []interface{} = []interface{}{1, 2, "str", nil, map[interface{}]interface{}{"f": "buzz"}} /* obj.values() */ suite.T().Log("About to run line #142: obj.Values()") runAndAssert(suite.Suite, expected_, obj.Values(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #142") } { // transform/object.yaml line #146 /* 5 */ var expected_ int = 5 /* obj.count() */ suite.T().Log("About to run line #146: obj.Count()") runAndAssert(suite.Suite, expected_, obj.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #146") } }
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") } }
func (suite *MatchSuite) TestCases() { suite.T().Log("Running MatchSuite: Tests for match") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors { // match.yaml line #4 /* ({'str':'bcde','groups':[null,{'start':2,'str':'cde','end':5}],'start':1,'end':5}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"str": "bcde", "groups": []interface{}{nil, map[interface{}]interface{}{"start": 2, "str": "cde", "end": 5}}, "start": 1, "end": 5} /* r.expr("abcdefg").match("a(b.e)|b(c.e)") */ suite.T().Log("About to run line #4: r.Expr('abcdefg').Match('a(b.e)|b(c.e)')") runAndAssert(suite.Suite, expected_, r.Expr("abcdefg").Match("a(b.e)|b(c.e)"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } { // match.yaml line #6 /* (null) */ var expected_ interface{} = nil /* r.expr("abcdefg").match("a(b.e)|B(c.e)") */ suite.T().Log("About to run line #6: r.Expr('abcdefg').Match('a(b.e)|B(c.e)')") runAndAssert(suite.Suite, expected_, r.Expr("abcdefg").Match("a(b.e)|B(c.e)"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // match.yaml line #8 /* ({'str':'bcde','groups':[null,{'start':2,'str':'cde','end':5}],'start':1,'end':5}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"str": "bcde", "groups": []interface{}{nil, map[interface{}]interface{}{"start": 2, "str": "cde", "end": 5}}, "start": 1, "end": 5} /* r.expr("abcdefg").match("(?i)a(b.e)|B(c.e)") */ suite.T().Log("About to run line #8: r.Expr('abcdefg').Match('(?i)a(b.e)|B(c.e)')") runAndAssert(suite.Suite, expected_, r.Expr("abcdefg").Match("(?i)a(b.e)|B(c.e)"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // match.yaml line #12 /* (["aca", "ada"]) */ var expected_ []interface{} = []interface{}{"aca", "ada"} /* r.expr(["aba", "aca", "ada", "aea"]).filter(lambda row:row.match("a(.)a")['groups'][0]['str'].match("[cd]")) */ suite.T().Log("About to run line #12: r.Expr([]interface{}{'aba', 'aca', 'ada', 'aea'}).Filter(func(row r.Term) interface{} { return row.Match('a(.)a').AtIndex('groups').AtIndex(0).AtIndex('str').Match('[cd]')})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{"aba", "aca", "ada", "aea"}).Filter(func(row r.Term) interface{} { return row.Match("a(.)a").AtIndex("groups").AtIndex(0).AtIndex("str").Match("[cd]") }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // match.yaml line #16 /* ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':3}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 3} /* tbl.insert([{'id':0,'a':'abc'},{'id':1,'a':'ab'},{'id':2,'a':'bc'}]) */ suite.T().Log("About to run line #16: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 0, 'a': 'abc', }, map[interface{}]interface{}{'id': 1, 'a': 'ab', }, map[interface{}]interface{}{'id': 2, 'a': 'bc', }})") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 0, "a": "abc"}, map[interface{}]interface{}{"id": 1, "a": "ab"}, map[interface{}]interface{}{"id": 2, "a": "bc"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // match.yaml line #20 /* ([{'id':0,'a':'abc'},{'id':1,'a':'ab'},{'id':2,'a':'bc'}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 0, "a": "abc"}, map[interface{}]interface{}{"id": 1, "a": "ab"}, map[interface{}]interface{}{"id": 2, "a": "bc"}} /* tbl.filter(lambda row:row['a'].match('b')).order_by('id') */ suite.T().Log("About to run line #20: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('b')}).OrderBy('id')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("b") }).OrderBy("id"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // match.yaml line #24 /* ([{'id':0,'a':'abc'},{'id':1,'a':'ab'}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 0, "a": "abc"}, map[interface{}]interface{}{"id": 1, "a": "ab"}} /* tbl.filter(lambda row:row['a'].match('ab')).order_by('id') */ suite.T().Log("About to run line #24: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('ab')}).OrderBy('id')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("ab") }).OrderBy("id"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // match.yaml line #28 /* ([{'id':1,'a':'ab'}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "a": "ab"}} /* tbl.filter(lambda row:row['a'].match('ab$')).order_by('id') */ suite.T().Log("About to run line #28: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('ab$')}).OrderBy('id')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("ab$") }).OrderBy("id"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // match.yaml line #32 /* ([]) */ var expected_ []interface{} = []interface{}{} /* tbl.filter(lambda row:row['a'].match('^b$')).order_by('id') */ suite.T().Log("About to run line #32: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('^b$')}).OrderBy('id')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("^b$") }).OrderBy("id"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #32") } { // match.yaml line #36 /* err("ReqlQueryLogicError", "Error in regexp `ab\\9` (portion `\\9`): invalid escape sequence: \\9", []) */ var expected_ Err = err("ReqlQueryLogicError", "Error in regexp `ab\\9` (portion `\\9`): invalid escape sequence: \\9") /* r.expr("").match("ab\\9") */ suite.T().Log("About to run line #36: r.Expr('').Match('ab\\\\9')") runAndAssert(suite.Suite, expected_, r.Expr("").Match("ab\\9"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } }
func (suite *MathLogicAddSuite) TestCases() { suite.T().Log("Running MathLogicAddSuite: Tests for basic usage of the add operation") { // math_logic/add.yaml line #3 /* 2 */ var expected_ int = 2 /* r.add(1, 1) */ suite.T().Log("About to run line #3: r.Add(1, 1)") runAndAssert(suite.Suite, expected_, r.Add(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #3") } { // math_logic/add.yaml line #8 /* 2 */ var expected_ int = 2 /* r.expr(1) + 1 */ suite.T().Log("About to run line #8: r.Expr(1).Add(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Add(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // math_logic/add.yaml line #9 /* 2 */ var expected_ int = 2 /* 1 + r.expr(1) */ suite.T().Log("About to run line #9: r.Add(1, r.Expr(1))") runAndAssert(suite.Suite, expected_, r.Add(1, r.Expr(1)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // math_logic/add.yaml line #10 /* 2 */ var expected_ int = 2 /* r.expr(1).add(1) */ suite.T().Log("About to run line #10: r.Expr(1).Add(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Add(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // math_logic/add.yaml line #16 /* 0 */ var expected_ int = 0 /* r.expr(-1) + 1 */ suite.T().Log("About to run line #16: r.Expr(-1).Add(1)") runAndAssert(suite.Suite, expected_, r.Expr(-1).Add(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // math_logic/add.yaml line #21 /* 10.25 */ var expected_ float64 = 10.25 /* r.expr(1.75) + 8.5 */ suite.T().Log("About to run line #21: r.Expr(1.75).Add(8.5)") runAndAssert(suite.Suite, expected_, r.Expr(1.75).Add(8.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // math_logic/add.yaml line #27 /* '' */ var expected_ string = "" /* r.expr('') + '' */ suite.T().Log("About to run line #27: r.Expr('').Add('')") runAndAssert(suite.Suite, expected_, r.Expr("").Add(""), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // math_logic/add.yaml line #32 /* 'abcdef' */ var expected_ string = "abcdef" /* r.expr('abc') + 'def' */ suite.T().Log("About to run line #32: r.Expr('abc').Add('def')") runAndAssert(suite.Suite, expected_, r.Expr("abc").Add("def"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #32") } { // math_logic/add.yaml line #52 /* 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 #52: r.Expr(1).Add('a')") runAndAssert(suite.Suite, expected_, r.Expr(1).Add("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // math_logic/add.yaml line #57 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [1]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* r.expr('a') + 1 */ suite.T().Log("About to run line #57: r.Expr('a').Add(1)") runAndAssert(suite.Suite, expected_, r.Expr("a").Add(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // math_logic/add.yaml line #62 /* err("ReqlQueryLogicError", "Expected type ARRAY but found NUMBER.", [1]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type ARRAY but found NUMBER.") /* r.expr([]) + 1 */ suite.T().Log("About to run line #62: r.Expr([]interface{}{}).Add(1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Add(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } }
func (suite *JoinsSuite) TestCases() { suite.T().Log("Running JoinsSuite: Tests that manipulation data in tables") messages := r.DB("test").Table("messages") _ = messages // Prevent any noused variable errors otbl := r.DB("test").Table("otbl") _ = otbl // Prevent any noused variable errors otbl2 := r.DB("test").Table("otbl2") _ = otbl2 // Prevent any noused variable errors receivers := r.DB("test").Table("receivers") _ = receivers // Prevent any noused variable errors senders := r.DB("test").Table("senders") _ = senders // Prevent any noused variable errors tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors { // joins.yaml line #7 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('test3', primary_key='foo') */ suite.T().Log("About to run line #7: r.DB('test').TableCreate('test3').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test3").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } // joins.yaml line #11 // tbl3 = r.db('test').table('test3') suite.T().Log("Possibly executing: var tbl3 r.Term = r.DB('test').Table('test3')") tbl3 := r.DB("test").Table("test3") _ = tbl3 // Prevent any noused variable errors { // joins.yaml line #13 /* partial({'errors':0, 'inserted':100}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100}) /* tbl.insert(r.range(0, 100).map({'id':r.row, 'a':r.row % 4})) */ suite.T().Log("About to run line #13: tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row.Mod(4), }))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row.Mod(4)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // joins.yaml line #18 /* partial({'errors':0, 'inserted':100}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100}) /* tbl2.insert(r.range(0, 100).map({'id':r.row, 'b':r.row % 4})) */ suite.T().Log("About to run line #18: tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Row.Mod(4), }))") runAndAssert(suite.Suite, expected_, tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // joins.yaml line #23 /* partial({'errors':0, 'inserted':100}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100}) /* tbl3.insert(r.range(0, 100).map({'foo':r.row, 'b':r.row % 4})) */ suite.T().Log("About to run line #23: tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'foo': r.Row, 'b': r.Row.Mod(4), }))") runAndAssert(suite.Suite, expected_, tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"foo": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // joins.yaml line #28 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* otbl.insert(r.range(1,100).map({'id': r.row, 'a': r.row})) */ suite.T().Log("About to run line #28: otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row, }))") runAndAssert(suite.Suite, expected_, otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // joins.yaml line #29 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* otbl2.insert(r.range(1,100).map({'id': r.row, 'b': 2 * r.row})) */ suite.T().Log("About to run line #29: otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Mul(2, r.Row), }))") runAndAssert(suite.Suite, expected_, otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Mul(2, r.Row)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } // joins.yaml line #34 // ij = tbl.inner_join(tbl2, lambda x,y:x['a'] == y['b']).zip() suite.T().Log("Possibly executing: var ij r.Term = tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()") ij := tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip() _ = ij // Prevent any noused variable errors { // joins.yaml line #37 /* 2500 */ var expected_ int = 2500 /* ij.count() */ suite.T().Log("About to run line #37: ij.Count()") runAndAssert(suite.Suite, expected_, ij.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // joins.yaml line #39 /* 0 */ var expected_ int = 0 /* ij.filter(lambda row:row['a'] != row['b']).count() */ suite.T().Log("About to run line #39: ij.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()") runAndAssert(suite.Suite, expected_, ij.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } // joins.yaml line #46 // oj = tbl.outer_join(tbl2, lambda x,y:x['a'] == y['b']).zip() suite.T().Log("Possibly executing: var oj r.Term = tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()") oj := tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip() _ = oj // Prevent any noused variable errors { // joins.yaml line #49 /* 2500 */ var expected_ int = 2500 /* oj.count() */ suite.T().Log("About to run line #49: oj.Count()") runAndAssert(suite.Suite, expected_, oj.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // joins.yaml line #51 /* 0 */ var expected_ int = 0 /* oj.filter(lambda row:row['a'] != row['b']).count() */ suite.T().Log("About to run line #51: oj.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()") runAndAssert(suite.Suite, expected_, oj.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } // joins.yaml line #57 // blah = otbl.order_by("id").eq_join(r.row['id'], otbl2, ordered=True).zip() suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()") blah := maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{}) _ = blah // Prevent any noused variable errors // joins.yaml line #59 // blah = otbl.order_by(r.desc("id")).eq_join(r.row['id'], otbl2, ordered=True).zip() suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy(r.Desc('id')).EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()") blah = maybeRun(otbl.OrderBy(r.Desc("id")).EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{}) // joins.yaml line #61 // blah = otbl.order_by("id").eq_join(r.row['a'], otbl2, ordered=True).zip() suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('a'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()") blah = maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("a"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{}) { // joins.yaml line #65 /* 100 */ var expected_ int = 100 /* tbl.eq_join('a', tbl2).zip().count() */ suite.T().Log("About to run line #65: tbl.EqJoin('a', tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // joins.yaml line #68 /* 0 */ var expected_ int = 0 /* tbl.eq_join('fake', tbl2).zip().count() */ suite.T().Log("About to run line #68: tbl.EqJoin('fake', tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin("fake", tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // joins.yaml line #71 /* 100 */ var expected_ int = 100 /* tbl.eq_join(lambda x:x['a'], tbl2).zip().count() */ suite.T().Log("About to run line #71: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // joins.yaml line #76 /* 0 */ var expected_ int = 0 /* tbl.eq_join(lambda x:x['fake'], tbl2).zip().count() */ suite.T().Log("About to run line #76: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('fake')}, tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("fake") }, tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #76") } { // joins.yaml line #81 /* 0 */ var expected_ int = 0 /* tbl.eq_join(lambda x:null, tbl2).zip().count() */ suite.T().Log("About to run line #81: tbl.EqJoin(func(x r.Term) interface{} { return nil}, tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return nil }, tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // joins.yaml line #86 /* 100 */ var expected_ int = 100 /* tbl.eq_join(lambda x:x['a'], tbl2).count() */ suite.T().Log("About to run line #86: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // joins.yaml line #92 /* 100 */ var expected_ int = 100 /* tbl.eq_join('a', tbl3).zip().count() */ suite.T().Log("About to run line #92: tbl.EqJoin('a', tbl3).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl3).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } { // joins.yaml line #95 /* 100 */ var expected_ int = 100 /* tbl.eq_join(lambda x:x['a'], tbl3).count() */ suite.T().Log("About to run line #95: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl3).Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl3).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // joins.yaml line #101 /* 100 */ var expected_ int = 100 /* tbl.eq_join(r.row['a'], tbl2).count() */ suite.T().Log("About to run line #101: tbl.EqJoin(r.Row.AtIndex('a'), tbl2).Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(r.Row.AtIndex("a"), tbl2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } // joins.yaml line #106 // left = r.expr([{'a':1},{'a':2},{'a':3}]) suite.T().Log("Possibly executing: var left r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'a': 2, }, map[interface{}]interface{}{'a': 3, }})") left := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}}) _ = left // Prevent any noused variable errors // joins.yaml line #107 // right = r.expr([{'b':2},{'b':3}]) suite.T().Log("Possibly executing: var right r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'b': 3, }})") right := r.Expr([]interface{}{map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"b": 3}}) _ = right // Prevent any noused variable errors { // joins.yaml line #109 /* [{'a':2,'b':2},{'a':3,'b':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}} /* left.inner_join(right, lambda l, r:l['a'] == r['b']).zip() */ suite.T().Log("About to run line #109: left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()") runAndAssert(suite.Suite, expected_, left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } { // joins.yaml line #115 /* [{'a':1},{'a':2,'b':2},{'a':3,'b':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}} /* left.outer_join(right, lambda l, r:l['a'] == r['b']).zip() */ suite.T().Log("About to run line #115: left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()") runAndAssert(suite.Suite, expected_, left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #115") } { // joins.yaml line #132 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.db('test').table_drop('test3') */ suite.T().Log("About to run line #132: r.DB('test').TableDrop('test3')") runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test3"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } }
func (suite *DefaultSuite) TestCases() { suite.T().Log("Running DefaultSuite: Tests r.default") { // default.yaml line #3 /* 1 */ var expected_ int = 1 /* r.expr(1).default(2) */ suite.T().Log("About to run line #3: r.Expr(1).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #3") } { // default.yaml line #5 /* 2 */ var expected_ int = 2 /* r.expr(null).default(2) */ suite.T().Log("About to run line #5: r.Expr(nil).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(nil).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // default.yaml line #7 /* 2 */ var expected_ int = 2 /* r.expr({})['b'].default(2) */ suite.T().Log("About to run line #7: r.Expr(map[interface{}]interface{}{}).AtIndex('b').Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).AtIndex("b").Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // default.yaml line #10 /* err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.") /* r.expr(r.expr('a')['b']).default(2) */ suite.T().Log("About to run line #10: r.Expr(r.Expr('a').AtIndex('b')).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(r.Expr("a").AtIndex("b")).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // default.yaml line #14 /* 2 */ var expected_ int = 2 /* r.expr([]).reduce(lambda a,b:a+b).default(2) */ suite.T().Log("About to run line #14: r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // default.yaml line #18 /* 2 */ var expected_ int = 2 /* r.expr([]).union([]).reduce(lambda a,b:a+b).default(2) */ suite.T().Log("About to run line #18: r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // default.yaml line #22 /* err("ReqlQueryLogicError", "Cannot convert STRING to SEQUENCE", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert STRING to SEQUENCE") /* r.expr('a').reduce(lambda a,b:a+b).default(2) */ suite.T().Log("About to run line #22: r.Expr('a').Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr("a").Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // default.yaml line #25 /* 2 */ var expected_ int = 2 /* (r.expr(null) + 5).default(2) */ suite.T().Log("About to run line #25: r.Expr(nil).Add(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(nil).Add(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // default.yaml line #28 /* 2 */ var expected_ int = 2 /* (5 + r.expr(null)).default(2) */ suite.T().Log("About to run line #28: r.Add(5, r.Expr(nil)).Default(2)") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr(nil)).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // default.yaml line #31 /* 2 */ var expected_ int = 2 /* (5 - r.expr(null)).default(2) */ suite.T().Log("About to run line #31: r.Sub(5, r.Expr(nil)).Default(2)") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr(nil)).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // default.yaml line #34 /* 2 */ var expected_ int = 2 /* (r.expr(null) - 5).default(2) */ suite.T().Log("About to run line #34: r.Expr(nil).Sub(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(nil).Sub(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // default.yaml line #37 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* (r.expr('a') + 5).default(2) */ suite.T().Log("About to run line #37: r.Expr('a').Add(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr("a").Add(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // default.yaml line #40 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* (5 + r.expr('a')).default(2) */ suite.T().Log("About to run line #40: r.Add(5, r.Expr('a')).Default(2)") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr("a")).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // default.yaml line #43 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* (r.expr('a') - 5).default(2) */ suite.T().Log("About to run line #43: r.Expr('a').Sub(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr("a").Sub(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // default.yaml line #46 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* (5 - r.expr('a')).default(2) */ suite.T().Log("About to run line #46: r.Sub(5, r.Expr('a')).Default(2)") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr("a")).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // default.yaml line #50 /* 1 */ var expected_ int = 1 /* r.expr(1).default(r.error()) */ suite.T().Log("About to run line #50: r.Expr(1).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(1).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // default.yaml line #52 /* (null) */ var expected_ interface{} = nil /* r.expr(null).default(r.error()) */ suite.T().Log("About to run line #52: r.Expr(nil).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(nil).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // default.yaml line #54 /* err("ReqlNonExistenceError", "No attribute `b` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `b` in object:") /* r.expr({})['b'].default(r.error()) */ suite.T().Log("About to run line #54: r.Expr(map[interface{}]interface{}{}).AtIndex('b').Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).AtIndex("b").Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // default.yaml line #58 /* err("ReqlNonExistenceError", "Cannot reduce over an empty stream.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Cannot reduce over an empty stream.") /* r.expr([]).reduce(lambda a,b:a+b).default(r.error) */ suite.T().Log("About to run line #58: r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // default.yaml line #62 /* err("ReqlNonExistenceError", "Cannot reduce over an empty stream.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Cannot reduce over an empty stream.") /* r.expr([]).union([]).reduce(lambda a,b:a+b).default(r.error) */ suite.T().Log("About to run line #62: r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } { // default.yaml line #65 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (r.expr(null) + 5).default(r.error) */ suite.T().Log("About to run line #65: r.Expr(nil).Add(5).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(nil).Add(5).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // default.yaml line #68 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (5 + r.expr(null)).default(r.error) */ suite.T().Log("About to run line #68: r.Add(5, r.Expr(nil)).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr(nil)).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // default.yaml line #71 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (5 - r.expr(null)).default(r.error) */ suite.T().Log("About to run line #71: r.Sub(5, r.Expr(nil)).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr(nil)).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // default.yaml line #74 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (r.expr(null) - 5).default(r.error) */ suite.T().Log("About to run line #74: r.Expr(nil).Sub(5).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(nil).Sub(5).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // default.yaml line #79 /* 1 */ var expected_ int = 1 /* r.expr(1).default(lambda e:e) */ suite.T().Log("About to run line #79: r.Expr(1).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(1).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #79") } { // default.yaml line #83 /* (null) */ var expected_ interface{} = nil /* r.expr(null).default(lambda e:e) */ suite.T().Log("About to run line #83: r.Expr(nil).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(nil).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } { // default.yaml line #87 /* "No attribute `b` in object:\n{}" */ var expected_ string = "No attribute `b` in object:\n{}" /* r.expr({})['b'].default(lambda e:e) */ suite.T().Log("About to run line #87: r.Expr(map[interface{}]interface{}{}).AtIndex('b').Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).AtIndex("b").Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #87") } { // default.yaml line #91 /* ("Cannot reduce over an empty stream.") */ var expected_ string = "Cannot reduce over an empty stream." /* r.expr([]).reduce(lambda a,b:a+b).default(lambda e:e) */ suite.T().Log("About to run line #91: r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #91") } { // default.yaml line #95 /* ("Cannot reduce over an empty stream.") */ var expected_ string = "Cannot reduce over an empty stream." /* r.expr([]).union([]).reduce(lambda a,b:a+b).default(lambda e:e) */ suite.T().Log("About to run line #95: r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // default.yaml line #99 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (r.expr(null) + 5).default(lambda e:e) */ suite.T().Log("About to run line #99: r.Expr(nil).Add(5).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(nil).Add(5).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // default.yaml line #103 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (5 + r.expr(null)).default(lambda e:e) */ suite.T().Log("About to run line #103: r.Add(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // default.yaml line #107 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (5 - r.expr(null)).default(lambda e:e) */ suite.T().Log("About to run line #107: r.Sub(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #107") } { // default.yaml line #111 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (r.expr(null) - 5).default(lambda e:e) */ suite.T().Log("About to run line #111: r.Expr(nil).Sub(5).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(nil).Sub(5).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } // default.yaml line #115 // arr = r.expr([{'a':1},{'a':null},{}]).order_by('a') suite.T().Log("Possibly executing: var arr r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'a': nil, }, map[interface{}]interface{}{}}).OrderBy('a')") arr := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{}}).OrderBy("a") _ = arr // Prevent any noused variable errors { // default.yaml line #118 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1)) */ suite.T().Log("About to run line #118: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #118") } { // default.yaml line #122 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=False) */ suite.T().Log("About to run line #122: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // default.yaml line #126 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=True) */ suite.T().Log("About to run line #126: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: true, })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #126") } { // default.yaml line #131 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=r.js('true')) */ suite.T().Log("About to run line #131: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.JS('true'), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.JS("true")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #131") } { // default.yaml line #135 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=r.js('false')) */ suite.T().Log("About to run line #135: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.JS('false'), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.JS("false")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // default.yaml line #139 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* arr.filter(lambda x:x['a'].eq(1), default=r.error()) */ suite.T().Log("About to run line #139: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #139") } { // default.yaml line #144 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(False).do(lambda d:arr.filter(lambda x:x['a'].eq(1), default=d)) */ suite.T().Log("About to run line #144: r.Expr(false).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })})") runAndAssert(suite.Suite, expected_, r.Expr(false).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #144") } { // default.yaml line #148 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* r.expr(True).do(lambda d:arr.filter(lambda x:x['a'].eq(1), default=d)).order_by('a') */ suite.T().Log("About to run line #148: r.Expr(true).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(true).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #148") } { // default.yaml line #154 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].default(0).eq(1)) */ suite.T().Log("About to run line #154: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(0).Eq(1)})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(0).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #154") } { // default.yaml line #158 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].default(1).eq(1)).order_by('a') */ suite.T().Log("About to run line #158: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(1).Eq(1)}).OrderBy('a')") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(1).Eq(1) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #158") } { // default.yaml line #162 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].default(r.error()).eq(1)) */ suite.T().Log("About to run line #162: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(r.Error()).Eq(1)})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(r.Error()).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #162") } { // default.yaml line #168 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(0).do(lambda i:arr.filter(lambda x:x['a'].default(i).eq(1))) */ suite.T().Log("About to run line #168: r.Expr(0).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})})") runAndAssert(suite.Suite, expected_, r.Expr(0).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #168") } { // default.yaml line #172 /* ([{},{'a':null},{'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* r.expr(1).do(lambda i:arr.filter(lambda x:x['a'].default(i).eq(1))).order_by('a') */ suite.T().Log("About to run line #172: r.Expr(1).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #172") } { // default.yaml line #177 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2))) */ suite.T().Log("About to run line #177: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #177") } { // default.yaml line #181 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=False) */ suite.T().Log("About to run line #181: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #181") } { // default.yaml line #185 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=True).order_by('a') */ suite.T().Log("About to run line #185: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: true, }).OrderBy('a')") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: true}).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #185") } { // default.yaml line #189 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=r.error()) */ suite.T().Log("About to run line #189: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #189") } { // default.yaml line #193 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.table_create('default_test') */ suite.T().Log("About to run line #193: r.TableCreate('default_test')") runAndAssert(suite.Suite, expected_, r.TableCreate("default_test"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #193") } { // default.yaml line #196 /* ({'deleted':0,'replaced':0,'generated_keys':arrlen(3,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':3}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "generated_keys": arrlen(3, compare.IsUUID()), "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 3} /* r.table('default_test').insert(arr) */ suite.T().Log("About to run line #196: r.Table('default_test').Insert(arr)") runAndAssert(suite.Suite, expected_, r.Table("default_test").Insert(arr), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #196") } // default.yaml line #199 // tbl = r.table('default_test').order_by('a').pluck('a') suite.T().Log("Possibly executing: var tbl r.Term = r.Table('default_test').OrderBy('a').Pluck('a')") tbl := r.Table("default_test").OrderBy("a").Pluck("a") _ = tbl // Prevent any noused variable errors { // default.yaml line #202 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].eq(1)) */ suite.T().Log("About to run line #202: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #202") } { // default.yaml line #206 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].eq(1), default=False) */ suite.T().Log("About to run line #206: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #206") } { // default.yaml line #210 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].eq(1), default=True) */ suite.T().Log("About to run line #210: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: true, })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #210") } { // default.yaml line #215 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* tbl.filter(lambda x:x['a'].eq(1), default=r.error()) */ suite.T().Log("About to run line #215: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #215") } { // default.yaml line #220 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(False).do(lambda d:tbl.filter(lambda x:x['a'].eq(1), default=d)) */ suite.T().Log("About to run line #220: r.Expr(false).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })})") runAndAssert(suite.Suite, expected_, r.Expr(false).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #220") } { // default.yaml line #224 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* r.expr(True).do(lambda d:tbl.filter(lambda x:x['a'].eq(1), default=d)).order_by('a') */ suite.T().Log("About to run line #224: r.Expr(true).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(true).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #224") } { // default.yaml line #230 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].default(0).eq(1)) */ suite.T().Log("About to run line #230: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(0).Eq(1)})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(0).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #230") } { // default.yaml line #234 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].default(1).eq(1)).order_by('a') */ suite.T().Log("About to run line #234: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(1).Eq(1)}).OrderBy('a')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(1).Eq(1) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #234") } { // default.yaml line #238 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].default(r.error()).eq(1)) */ suite.T().Log("About to run line #238: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(r.Error()).Eq(1)})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(r.Error()).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #238") } { // default.yaml line #244 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(0).do(lambda i:tbl.filter(lambda x:x['a'].default(i).eq(1))) */ suite.T().Log("About to run line #244: r.Expr(0).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})})") runAndAssert(suite.Suite, expected_, r.Expr(0).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #244") } { // default.yaml line #248 /* ([{},{'a':null},{'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* r.expr(1).do(lambda i:tbl.filter(lambda x:x['a'].default(i).eq(1))).order_by('a') */ suite.T().Log("About to run line #248: r.Expr(1).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #248") } { // default.yaml line #253 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2))) */ suite.T().Log("About to run line #253: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #253") } { // default.yaml line #257 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=False) */ suite.T().Log("About to run line #257: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #257") } { // default.yaml line #261 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=True).order_by('a') */ suite.T().Log("About to run line #261: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: true, }).OrderBy('a')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: true}).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #261") } { // default.yaml line #265 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=r.error()) */ suite.T().Log("About to run line #265: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #265") } { // default.yaml line #269 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.table_drop('default_test') */ suite.T().Log("About to run line #269: r.TableDrop('default_test')") runAndAssert(suite.Suite, expected_, r.TableDrop("default_test"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #269") } }
func (suite *PolymorphismSuite) TestCases() { suite.T().Log("Running PolymorphismSuite: Tests that manipulation data in tables") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors // polymorphism.yaml line #5 // obj = r.expr({'id':0,'a':0}) suite.T().Log("Possibly executing: var obj r.Term = r.Expr(map[interface{}]interface{}{'id': 0, 'a': 0, })") obj := r.Expr(map[interface{}]interface{}{"id": 0, "a": 0}) _ = obj // Prevent any noused variable errors { // polymorphism.yaml line #7 /* ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':3}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 3} /* tbl.insert([{'id':i, 'a':i} for i in xrange(3)]) */ suite.T().Log("About to run line #7: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 3; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'a': i, })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 3; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i, "a": i}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // polymorphism.yaml line #21 /* ({'id':0,'c':1,'a':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "c": 1, "a": 0} /* tbl.merge({'c':1}).nth(0) */ suite.T().Log("About to run line #21: tbl.Merge(map[interface{}]interface{}{'c': 1, }).Nth(0)") runAndAssert(suite.Suite, expected_, tbl.Merge(map[interface{}]interface{}{"c": 1}).Nth(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // polymorphism.yaml line #22 /* ({'id':0,'c':1,'a':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "c": 1, "a": 0} /* obj.merge({'c':1}) */ suite.T().Log("About to run line #22: obj.Merge(map[interface{}]interface{}{'c': 1, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"c": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // polymorphism.yaml line #26 /* ({'id':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} /* tbl.without('a').nth(0) */ suite.T().Log("About to run line #26: tbl.Without('a').Nth(0)") runAndAssert(suite.Suite, expected_, tbl.Without("a").Nth(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // polymorphism.yaml line #27 /* ({'id':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} /* obj.without('a') */ suite.T().Log("About to run line #27: obj.Without('a')") runAndAssert(suite.Suite, expected_, obj.Without("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // polymorphism.yaml line #31 /* ({'a':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 0} /* tbl.pluck('a').nth(0) */ suite.T().Log("About to run line #31: tbl.Pluck('a').Nth(0)") runAndAssert(suite.Suite, expected_, tbl.Pluck("a").Nth(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // polymorphism.yaml line #32 /* ({'a':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 0} /* obj.pluck('a') */ suite.T().Log("About to run line #32: obj.Pluck('a')") runAndAssert(suite.Suite, expected_, obj.Pluck("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #32") } }
func (suite *JsonSuite) TestCases() { suite.T().Log("Running JsonSuite: Tests RQL json parsing") { // json.yaml line #4 /* [1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.json("[1,2,3]") */ suite.T().Log("About to run line #4: r.JSON('[1,2,3]')") runAndAssert(suite.Suite, expected_, r.JSON("[1,2,3]"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } { // json.yaml line #7 /* 1 */ var expected_ int = 1 /* r.json("1") */ suite.T().Log("About to run line #7: r.JSON('1')") runAndAssert(suite.Suite, expected_, r.JSON("1"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // json.yaml line #10 /* {} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{} /* r.json("{}") */ suite.T().Log("About to run line #10: r.JSON('{}')") runAndAssert(suite.Suite, expected_, r.JSON("{}"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // json.yaml line #13 /* "foo" */ var expected_ string = "foo" /* r.json('"foo"') */ suite.T().Log("About to run line #13: r.JSON('\\'foo\\'')") runAndAssert(suite.Suite, expected_, r.JSON("\"foo\""), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // json.yaml line #16 /* err("ReqlQueryLogicError", 'Failed to parse "[1,2" as JSON:' + ' Missing a comma or \']\' after an array element.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Failed to parse \"[1,2\" as JSON:"+" Missing a comma or ']' after an array element.") /* r.json("[1,2") */ suite.T().Log("About to run line #16: r.JSON('[1,2')") runAndAssert(suite.Suite, expected_, r.JSON("[1,2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // json.yaml line #19 /* '[1,2,3]' */ var expected_ string = "[1,2,3]" /* r.json("[1,2,3]").to_json_string() */ suite.T().Log("About to run line #19: r.JSON('[1,2,3]').ToJSON()") runAndAssert(suite.Suite, expected_, r.JSON("[1,2,3]").ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // json.yaml line #23 /* '[1,2,3]' */ var expected_ string = "[1,2,3]" /* r.json("[1,2,3]").to_json() */ suite.T().Log("About to run line #23: r.JSON('[1,2,3]').ToJSON()") runAndAssert(suite.Suite, expected_, r.JSON("[1,2,3]").ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // json.yaml line #26 /* '{"foo":4}' */ var expected_ string = "{\"foo\":4}" /* r.json("{\"foo\":4}").to_json_string() */ suite.T().Log("About to run line #26: r.JSON('{\\'foo\\':4}').ToJSON()") runAndAssert(suite.Suite, expected_, r.JSON("{\"foo\":4}").ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // json.yaml line #30 /* '{"foo":4}' */ var expected_ string = "{\"foo\":4}" /* r.json("{\"foo\":4}").to_json() */ suite.T().Log("About to run line #30: r.JSON('{\\'foo\\':4}').ToJSON()") runAndAssert(suite.Suite, expected_, r.JSON("{\"foo\":4}").ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } // json.yaml line #34 // text = '[{"id":1,"first_name":"Harry","last_name":"Riley","email":"*****@*****.**","country":"Andorra","ip_address":"221.25.65.136"},{"id":2,"first_name":"Bonnie","last_name":"Anderson","email":"*****@*****.**","country":"Tuvalu","ip_address":"116.162.43.150"},{"id":3,"first_name":"Marie","last_name":"Schmidt","email":"*****@*****.**","country":"Iraq","ip_address":"181.105.59.57"},{"id":4,"first_name":"Phillip","last_name":"Willis","email":"*****@*****.**","country":"Montenegro","ip_address":"24.223.139.156"}]' suite.T().Log("Possibly executing: var text string = '[{\\'id\\':1,\\'first_name\\':\\'Harry\\',\\'last_name\\':\\'Riley\\',\\'email\\':\\'[email protected]\\',\\'country\\':\\'Andorra\\',\\'ip_address\\':\\'221.25.65.136\\'},{\\'id\\':2,\\'first_name\\':\\'Bonnie\\',\\'last_name\\':\\'Anderson\\',\\'email\\':\\'[email protected]\\',\\'country\\':\\'Tuvalu\\',\\'ip_address\\':\\'116.162.43.150\\'},{\\'id\\':3,\\'first_name\\':\\'Marie\\',\\'last_name\\':\\'Schmidt\\',\\'email\\':\\'[email protected]\\',\\'country\\':\\'Iraq\\',\\'ip_address\\':\\'181.105.59.57\\'},{\\'id\\':4,\\'first_name\\':\\'Phillip\\',\\'last_name\\':\\'Willis\\',\\'email\\':\\'[email protected]\\',\\'country\\':\\'Montenegro\\',\\'ip_address\\':\\'24.223.139.156\\'}]'") text := "[{\"id\":1,\"first_name\":\"Harry\",\"last_name\":\"Riley\",\"email\":\"[email protected]\",\"country\":\"Andorra\",\"ip_address\":\"221.25.65.136\"},{\"id\":2,\"first_name\":\"Bonnie\",\"last_name\":\"Anderson\",\"email\":\"[email protected]\",\"country\":\"Tuvalu\",\"ip_address\":\"116.162.43.150\"},{\"id\":3,\"first_name\":\"Marie\",\"last_name\":\"Schmidt\",\"email\":\"[email protected]\",\"country\":\"Iraq\",\"ip_address\":\"181.105.59.57\"},{\"id\":4,\"first_name\":\"Phillip\",\"last_name\":\"Willis\",\"email\":\"[email protected]\",\"country\":\"Montenegro\",\"ip_address\":\"24.223.139.156\"}]" _ = text // Prevent any noused variable errors // json.yaml line #35 // sorted = '[{"country":"Andorra","email":"*****@*****.**","first_name":"Harry","id":1,"ip_address":"221.25.65.136","last_name":"Riley"},{"country":"Tuvalu","email":"*****@*****.**","first_name":"Bonnie","id":2,"ip_address":"116.162.43.150","last_name":"Anderson"},{"country":"Iraq","email":"*****@*****.**","first_name":"Marie","id":3,"ip_address":"181.105.59.57","last_name":"Schmidt"},{"country":"Montenegro","email":"*****@*****.**","first_name":"Phillip","id":4,"ip_address":"24.223.139.156","last_name":"Willis"}]' suite.T().Log("Possibly executing: var sorted string = '[{\\'country\\':\\'Andorra\\',\\'email\\':\\'[email protected]\\',\\'first_name\\':\\'Harry\\',\\'id\\':1,\\'ip_address\\':\\'221.25.65.136\\',\\'last_name\\':\\'Riley\\'},{\\'country\\':\\'Tuvalu\\',\\'email\\':\\'[email protected]\\',\\'first_name\\':\\'Bonnie\\',\\'id\\':2,\\'ip_address\\':\\'116.162.43.150\\',\\'last_name\\':\\'Anderson\\'},{\\'country\\':\\'Iraq\\',\\'email\\':\\'[email protected]\\',\\'first_name\\':\\'Marie\\',\\'id\\':3,\\'ip_address\\':\\'181.105.59.57\\',\\'last_name\\':\\'Schmidt\\'},{\\'country\\':\\'Montenegro\\',\\'email\\':\\'[email protected]\\',\\'first_name\\':\\'Phillip\\',\\'id\\':4,\\'ip_address\\':\\'24.223.139.156\\',\\'last_name\\':\\'Willis\\'}]'") sorted := "[{\"country\":\"Andorra\",\"email\":\"[email protected]\",\"first_name\":\"Harry\",\"id\":1,\"ip_address\":\"221.25.65.136\",\"last_name\":\"Riley\"},{\"country\":\"Tuvalu\",\"email\":\"[email protected]\",\"first_name\":\"Bonnie\",\"id\":2,\"ip_address\":\"116.162.43.150\",\"last_name\":\"Anderson\"},{\"country\":\"Iraq\",\"email\":\"[email protected]\",\"first_name\":\"Marie\",\"id\":3,\"ip_address\":\"181.105.59.57\",\"last_name\":\"Schmidt\"},{\"country\":\"Montenegro\",\"email\":\"[email protected]\",\"first_name\":\"Phillip\",\"id\":4,\"ip_address\":\"24.223.139.156\",\"last_name\":\"Willis\"}]" _ = sorted // Prevent any noused variable errors { // json.yaml line #37 /* sorted */ var expected_ string = sorted /* r.json(text).to_json_string() */ suite.T().Log("About to run line #37: r.JSON(text).ToJSON()") runAndAssert(suite.Suite, expected_, r.JSON(text).ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // json.yaml line #40 /* err('ReqlQueryLogicError', 'Cannot convert `r.minval` to JSON.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert `r.minval` to JSON.") /* r.expr(r.minval).to_json_string() */ suite.T().Log("About to run line #40: r.Expr(r.MinVal).ToJSON()") runAndAssert(suite.Suite, expected_, r.Expr(r.MinVal).ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // json.yaml line #43 /* err('ReqlQueryLogicError', 'Cannot convert `r.maxval` to JSON.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert `r.maxval` to JSON.") /* r.expr(r.maxval).to_json_string() */ suite.T().Log("About to run line #43: r.Expr(r.MaxVal).ToJSON()") runAndAssert(suite.Suite, expected_, r.Expr(r.MaxVal).ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // json.yaml line #46 /* err('ReqlQueryLogicError', 'Cannot convert `r.minval` to JSON.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert `r.minval` to JSON.") /* r.expr(r.minval).coerce_to('string') */ suite.T().Log("About to run line #46: r.Expr(r.MinVal).CoerceTo('string')") runAndAssert(suite.Suite, expected_, r.Expr(r.MinVal).CoerceTo("string"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // json.yaml line #49 /* err('ReqlQueryLogicError', 'Cannot convert `r.maxval` to JSON.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert `r.maxval` to JSON.") /* r.expr(r.maxval).coerce_to('string') */ suite.T().Log("About to run line #49: r.Expr(r.MaxVal).CoerceTo('string')") runAndAssert(suite.Suite, expected_, r.Expr(r.MaxVal).CoerceTo("string"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // json.yaml line #52 /* {'timezone':'+00:00','$reql_type$':'TIME','epoch_time':1410393600} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"timezone": "+00:00", "$reql_type$": "TIME", "epoch_time": 1410393600} /* r.time(2014,9,11, 'Z') */ suite.T().Log("About to run line #52: r.Time(2014, 9, 11, 'Z')") runAndAssert(suite.Suite, expected_, r.Time(2014, 9, 11, "Z"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", TimeFormat: "raw", }) suite.T().Log("Finished running line #52") } { // json.yaml line #57 /* '{"$reql_type$":"TIME","epoch_time":1410393600,"timezone":"+00:00"}' */ var expected_ string = "{\"$reql_type$\":\"TIME\",\"epoch_time\":1410393600,\"timezone\":\"+00:00\"}" /* r.time(2014,9,11, 'Z').to_json_string() */ suite.T().Log("About to run line #57: r.Time(2014, 9, 11, 'Z').ToJSON()") runAndAssert(suite.Suite, expected_, r.Time(2014, 9, 11, "Z").ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // json.yaml line #60 /* {'$reql_type$':'GEOMETRY','coordinates':[0,0],'type':'Point'} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"$reql_type$": "GEOMETRY", "coordinates": []interface{}{0, 0}, "type": "Point"} /* r.point(0,0) */ suite.T().Log("About to run line #60: r.Point(0, 0)") runAndAssert(suite.Suite, expected_, r.Point(0, 0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // json.yaml line #63 /* '{"$reql_type$":"GEOMETRY","coordinates":[0,0],"type":"Point"}' */ var expected_ string = "{\"$reql_type$\":\"GEOMETRY\",\"coordinates\":[0,0],\"type\":\"Point\"}" /* r.point(0,0).to_json_string() */ suite.T().Log("About to run line #63: r.Point(0, 0).ToJSON()") runAndAssert(suite.Suite, expected_, r.Point(0, 0).ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } // json.yaml line #68 // s = b'\x66\x6f\x6f' suite.T().Log("Possibly executing: var s []byte = []byte{102,111,111}") s := []byte{102, 111, 111} _ = s // Prevent any noused variable errors { // json.yaml line #70 /* s */ var expected_ []byte = s /* r.binary(s) */ suite.T().Log("About to run line #70: r.Binary(s)") runAndAssert(suite.Suite, expected_, r.Binary(s), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // json.yaml line #73 /* '{"$reql_type$":"BINARY","data":"Zm9v"}' */ var expected_ string = "{\"$reql_type$\":\"BINARY\",\"data\":\"Zm9v\"}" /* r.expr("foo").coerce_to("binary").to_json_string() */ suite.T().Log("About to run line #73: r.Expr('foo').CoerceTo('binary').ToJSON()") runAndAssert(suite.Suite, expected_, r.Expr("foo").CoerceTo("binary").ToJSON(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } }
func (suite *MathLogicLogicSuite) TestCases() { suite.T().Log("Running MathLogicLogicSuite: These tests are aimed at &&, ||, and !") { // math_logic/logic.yaml line #8 /* true */ var expected_ bool = true /* r.expr(true) & true */ suite.T().Log("About to run line #8: 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 #8") } { // math_logic/logic.yaml line #9 /* true */ var expected_ bool = true /* true & r.expr(true) */ suite.T().Log("About to run line #9: r.And(true, r.Expr(true))") runAndAssert(suite.Suite, expected_, r.And(true, r.Expr(true)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // math_logic/logic.yaml line #10 /* true */ var expected_ bool = true /* r.and_(true,true) */ suite.T().Log("About to run line #10: 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 #10") } { // math_logic/logic.yaml line #11 /* true */ var expected_ bool = true /* r.expr(true).and_(true) */ suite.T().Log("About to run line #11: 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 #11") } { // math_logic/logic.yaml line #22 /* false */ var expected_ bool = false /* r.expr(true) & false */ suite.T().Log("About to run line #22: r.Expr(true).And(false)") runAndAssert(suite.Suite, expected_, r.Expr(true).And(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // math_logic/logic.yaml line #23 /* false */ var expected_ bool = false /* r.expr(false) & false */ suite.T().Log("About to run line #23: r.Expr(false).And(false)") runAndAssert(suite.Suite, expected_, r.Expr(false).And(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // math_logic/logic.yaml line #24 /* false */ var expected_ bool = false /* true & r.expr(false) */ suite.T().Log("About to run line #24: r.And(true, r.Expr(false))") runAndAssert(suite.Suite, expected_, r.And(true, r.Expr(false)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // math_logic/logic.yaml line #25 /* false */ var expected_ bool = false /* false & r.expr(false) */ suite.T().Log("About to run line #25: r.And(false, r.Expr(false))") runAndAssert(suite.Suite, expected_, r.And(false, r.Expr(false)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // math_logic/logic.yaml line #26 /* false */ var expected_ bool = false /* r.and_(true,false) */ suite.T().Log("About to run line #26: r.And(true, false)") runAndAssert(suite.Suite, expected_, r.And(true, false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // math_logic/logic.yaml line #27 /* false */ var expected_ bool = false /* r.and_(false,false) */ suite.T().Log("About to run line #27: r.And(false, false)") runAndAssert(suite.Suite, expected_, r.And(false, false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // math_logic/logic.yaml line #28 /* false */ var expected_ bool = false /* r.expr(true).and_(false) */ suite.T().Log("About to run line #28: r.Expr(true).And(false)") runAndAssert(suite.Suite, expected_, r.Expr(true).And(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // math_logic/logic.yaml line #29 /* false */ var expected_ bool = false /* r.expr(false).and_(false) */ suite.T().Log("About to run line #29: r.Expr(false).And(false)") runAndAssert(suite.Suite, expected_, r.Expr(false).And(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // math_logic/logic.yaml line #48 /* true */ var expected_ bool = true /* r.expr(true) | true */ suite.T().Log("About to run line #48: 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 #48") } { // math_logic/logic.yaml line #49 /* true */ var expected_ bool = true /* r.expr(true) | false */ suite.T().Log("About to run line #49: r.Expr(true).Or(false)") runAndAssert(suite.Suite, expected_, r.Expr(true).Or(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // math_logic/logic.yaml line #50 /* true */ var expected_ bool = true /* true | r.expr(true) */ suite.T().Log("About to run line #50: r.Or(true, r.Expr(true))") runAndAssert(suite.Suite, expected_, r.Or(true, r.Expr(true)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // math_logic/logic.yaml line #51 /* true */ var expected_ bool = true /* true | r.expr(false) */ suite.T().Log("About to run line #51: r.Or(true, r.Expr(false))") runAndAssert(suite.Suite, expected_, r.Or(true, r.Expr(false)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // math_logic/logic.yaml line #52 /* true */ var expected_ bool = true /* r.or_(true,true) */ suite.T().Log("About to run line #52: 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 #52") } { // math_logic/logic.yaml line #53 /* true */ var expected_ bool = true /* r.or_(true,false) */ suite.T().Log("About to run line #53: r.Or(true, false)") runAndAssert(suite.Suite, expected_, r.Or(true, false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // math_logic/logic.yaml line #54 /* true */ var expected_ bool = true /* r.expr(true).or_(true) */ suite.T().Log("About to run line #54: 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 #54") } { // math_logic/logic.yaml line #55 /* true */ var expected_ bool = true /* r.expr(true).or_(false) */ suite.T().Log("About to run line #55: r.Expr(true).Or(false)") runAndAssert(suite.Suite, expected_, r.Expr(true).Or(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // math_logic/logic.yaml line #72 /* false */ var expected_ bool = false /* r.expr(false) | false */ suite.T().Log("About to run line #72: r.Expr(false).Or(false)") runAndAssert(suite.Suite, expected_, r.Expr(false).Or(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #72") } { // math_logic/logic.yaml line #73 /* false */ var expected_ bool = false /* false | r.expr(false) */ suite.T().Log("About to run line #73: r.Or(false, r.Expr(false))") runAndAssert(suite.Suite, expected_, r.Or(false, r.Expr(false)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // math_logic/logic.yaml line #74 /* false */ var expected_ bool = false /* r.and_(false,false) */ suite.T().Log("About to run line #74: r.And(false, false)") runAndAssert(suite.Suite, expected_, r.And(false, false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // math_logic/logic.yaml line #75 /* false */ var expected_ bool = false /* r.expr(false).and_(false) */ suite.T().Log("About to run line #75: r.Expr(false).And(false)") runAndAssert(suite.Suite, expected_, r.Expr(false).And(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #75") } { // math_logic/logic.yaml line #88 /* false */ var expected_ bool = false /* ~r.expr(True) */ suite.T().Log("About to run line #88: r.Expr(true).Not()") runAndAssert(suite.Suite, expected_, r.Expr(true).Not(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #88") } { // math_logic/logic.yaml line #89 /* false */ var expected_ bool = false /* r.not_(True) */ suite.T().Log("About to run line #89: r.Not(true)") runAndAssert(suite.Suite, expected_, r.Not(true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // math_logic/logic.yaml line #93 /* true */ var expected_ bool = true /* ~r.expr(False) */ suite.T().Log("About to run line #93: 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 #93") } { // math_logic/logic.yaml line #94 /* true */ var expected_ bool = true /* r.not_(False) */ suite.T().Log("About to run line #94: r.Not(false)") runAndAssert(suite.Suite, expected_, r.Not(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #94") } { // math_logic/logic.yaml line #97 /* false */ var expected_ bool = false /* r.expr(True).not_() */ suite.T().Log("About to run line #97: r.Expr(true).Not()") runAndAssert(suite.Suite, expected_, r.Expr(true).Not(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #97") } { // math_logic/logic.yaml line #100 /* true */ var expected_ bool = true /* r.expr(False).not_() */ suite.T().Log("About to run line #100: 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 #100") } { // math_logic/logic.yaml line #107 /* true */ var expected_ bool = true /* ~r.and_(True, True) == r.or_(~r.expr(True), ~r.expr(True)) */ suite.T().Log("About to run line #107: r.And(true, true).Not().Eq(r.Or(r.Expr(true).Not(), r.Expr(true).Not()))") runAndAssert(suite.Suite, expected_, r.And(true, true).Not().Eq(r.Or(r.Expr(true).Not(), r.Expr(true).Not())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #107") } { // math_logic/logic.yaml line #108 /* true */ var expected_ bool = true /* ~r.and_(True, False) == r.or_(~r.expr(True), ~r.expr(False)) */ suite.T().Log("About to run line #108: r.And(true, false).Not().Eq(r.Or(r.Expr(true).Not(), r.Expr(false).Not()))") runAndAssert(suite.Suite, expected_, r.And(true, false).Not().Eq(r.Or(r.Expr(true).Not(), r.Expr(false).Not())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // math_logic/logic.yaml line #109 /* true */ var expected_ bool = true /* ~r.and_(False, False) == r.or_(~r.expr(False), ~r.expr(False)) */ suite.T().Log("About to run line #109: r.And(false, false).Not().Eq(r.Or(r.Expr(false).Not(), r.Expr(false).Not()))") runAndAssert(suite.Suite, expected_, r.And(false, false).Not().Eq(r.Or(r.Expr(false).Not(), r.Expr(false).Not())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } { // math_logic/logic.yaml line #110 /* true */ var expected_ bool = true /* ~r.and_(False, True) == r.or_(~r.expr(False), ~r.expr(True)) */ suite.T().Log("About to run line #110: r.And(false, true).Not().Eq(r.Or(r.Expr(false).Not(), r.Expr(true).Not()))") runAndAssert(suite.Suite, expected_, r.And(false, true).Not().Eq(r.Or(r.Expr(false).Not(), r.Expr(true).Not())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #110") } { // math_logic/logic.yaml line #120 /* true */ var expected_ bool = true /* r.and_(True, True, True, True, True) */ suite.T().Log("About to run line #120: r.And(true, true, true, true, true)") runAndAssert(suite.Suite, expected_, r.And(true, true, true, true, true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #120") } { // math_logic/logic.yaml line #123 /* false */ var expected_ bool = false /* r.and_(True, True, True, False, True) */ suite.T().Log("About to run line #123: r.And(true, true, true, false, true)") runAndAssert(suite.Suite, expected_, r.And(true, true, true, false, true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #123") } { // math_logic/logic.yaml line #126 /* false */ var expected_ bool = false /* r.and_(True, False, True, False, True) */ suite.T().Log("About to run line #126: r.And(true, false, true, false, true)") runAndAssert(suite.Suite, expected_, r.And(true, false, true, false, true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #126") } { // math_logic/logic.yaml line #129 /* false */ var expected_ bool = false /* r.or_(False, False, False, False, False) */ suite.T().Log("About to run line #129: r.Or(false, false, false, false, false)") runAndAssert(suite.Suite, expected_, r.Or(false, false, false, false, false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #129") } { // math_logic/logic.yaml line #132 /* true */ var expected_ bool = true /* r.or_(False, False, False, True, False) */ suite.T().Log("About to run line #132: r.Or(false, false, false, true, false)") runAndAssert(suite.Suite, expected_, r.Or(false, false, false, true, false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } { // math_logic/logic.yaml line #135 /* true */ var expected_ bool = true /* r.or_(False, True, False, True, False) */ suite.T().Log("About to run line #135: r.Or(false, true, false, true, false)") runAndAssert(suite.Suite, expected_, r.Or(false, true, false, true, false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // math_logic/logic.yaml line #140 /* err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.") /* r.expr(r.expr('a')['b']).default(2) */ suite.T().Log("About to run line #140: r.Expr(r.Expr('a').AtIndex('b')).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(r.Expr("a").AtIndex("b")).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #140") } { // math_logic/logic.yaml line #145 /* False */ var expected_ bool = false /* r.expr(r.and_(True, False) == r.or_(False, True)) */ suite.T().Log("About to run line #145: r.Expr(r.And(true, false).Eq(r.Or(false, true)))") runAndAssert(suite.Suite, expected_, r.Expr(r.And(true, false).Eq(r.Or(false, true))), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #145") } { // math_logic/logic.yaml line #151 /* False */ var expected_ bool = false /* r.expr(r.and_(True, False) >= r.or_(False, True)) */ suite.T().Log("About to run line #151: r.Expr(r.And(true, false).Ge(r.Or(false, true)))") runAndAssert(suite.Suite, expected_, r.Expr(r.And(true, false).Ge(r.Or(false, true))), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #151") } { // math_logic/logic.yaml line #155 /* true */ var expected_ bool = true /* r.expr(1) & True */ suite.T().Log("About to run line #155: r.Expr(1).And(true)") runAndAssert(suite.Suite, expected_, r.Expr(1).And(true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #155") } { // math_logic/logic.yaml line #159 /* ("str") */ var expected_ string = "str" /* r.expr(False) | 'str' */ suite.T().Log("About to run line #159: r.Expr(false).Or('str')") runAndAssert(suite.Suite, expected_, r.Expr(false).Or("str"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // math_logic/logic.yaml line #163 /* false */ var expected_ bool = false /* ~r.expr(1) */ suite.T().Log("About to run line #163: r.Expr(1).Not()") runAndAssert(suite.Suite, expected_, r.Expr(1).Not(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #163") } { // math_logic/logic.yaml line #167 /* true */ var expected_ bool = true /* ~r.expr(null) */ suite.T().Log("About to run line #167: r.Expr(nil).Not()") runAndAssert(suite.Suite, expected_, r.Expr(nil).Not(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #167") } }
func (suite *MutationDeleteSuite) TestCases() { suite.T().Log("Running MutationDeleteSuite: Tests deletes of selections") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors { // mutation/delete.yaml line #7 /* ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':100}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 100} /* tbl.insert([{'id':i} for i in xrange(100)]) */ suite.T().Log("About to run line #7: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // mutation/delete.yaml line #19 /* 100 */ var expected_ int = 100 /* tbl.count() */ suite.T().Log("About to run line #19: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // mutation/delete.yaml line #24 /* ({'deleted':1,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 1, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0} /* tbl.get(12).delete() */ suite.T().Log("About to run line #24: tbl.Get(12).Delete()") runAndAssert(suite.Suite, expected_, tbl.Get(12).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // mutation/delete.yaml line #31 /* err('ReqlQueryLogicError', 'Durability option `wrong` unrecognized (options are "hard" and "soft").', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Durability option `wrong` unrecognized (options are \"hard\" and \"soft\").") /* tbl.skip(50).delete(durability='wrong') */ suite.T().Log("About to run line #31: tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: 'wrong', })") runAndAssert(suite.Suite, expected_, tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: "wrong"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // mutation/delete.yaml line #38 /* ({'deleted':49,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 49, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0} /* tbl.skip(50).delete(durability='soft') */ suite.T().Log("About to run line #38: tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: 'soft', })") runAndAssert(suite.Suite, expected_, tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: "soft"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // mutation/delete.yaml line #45 /* ({'deleted':50,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 50, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0} /* tbl.delete(durability='hard') */ suite.T().Log("About to run line #45: tbl.Delete().OptArgs(r.DeleteOpts{Durability: 'hard', })") runAndAssert(suite.Suite, expected_, tbl.Delete().OptArgs(r.DeleteOpts{Durability: "hard"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #45") } { // mutation/delete.yaml line #49 /* err('ReqlQueryLogicError', 'Expected type SELECTION but found DATUM:', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type SELECTION but found DATUM:") /* r.expr([1, 2]).delete() */ suite.T().Log("About to run line #49: r.Expr([]interface{}{1, 2}).Delete()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } }