func (suite *TransformFoldSuite) TestCases() { suite.T().Log("Running TransformFoldSuite: Tests for the fold term") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors { // transform/fold.yaml line #6 /* {'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(r.range(100).map(lambda i: {'id':i, 'a':i%4}).coerce_to("array")) */ suite.T().Log("About to run line #6: tbl.Insert(r.Range(100).Map(func(i r.Term) interface{} { return map[interface{}]interface{}{'id': i, 'a': r.Mod(i, 4), }}).CoerceTo('array'))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(100).Map(func(i r.Term) interface{} { return map[interface{}]interface{}{"id": i, "a": r.Mod(i, 4)} }).CoerceTo("array")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // transform/fold.yaml line #19 /* 10 */ var expected_ int = 10 /* r.range(0, 10).fold(0, lambda acc, row: acc.add(1)) */ suite.T().Log("About to run line #19: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)})") runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // transform/fold.yaml line #23 /* 20 */ var expected_ int = 20 /* r.range(0, 10).fold(0, lambda acc, row: acc.add(1), final_emit=lambda acc: acc.mul(2)) */ suite.T().Log("About to run line #23: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{FinalEmit: func(acc r.Term) interface{} { return acc.Mul(2)}, })") runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{FinalEmit: func(acc r.Term) interface{} { return acc.Mul(2) }}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // transform/fold.yaml line #27 /* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] */ var expected_ []interface{} = []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} /* r.range(0, 10).fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [row]).coerce_to("array") */ suite.T().Log("About to run line #27: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{row}}, }).CoerceTo('array')") runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{row} }}).CoerceTo("array"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // transform/fold.yaml line #31 /* [2, 5, 8, 10] */ var expected_ []interface{} = []interface{}{2, 5, 8, 10} /* r.range(0, 10).fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: r.branch(acc.mod(3).eq(0),[row],[]),final_emit=lambda acc: [acc]).coerce_to("array") */ suite.T().Log("About to run line #31: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Branch(acc.Mod(3).Eq(0), []interface{}{row}, []interface{}{})}, FinalEmit: func(acc r.Term) interface{} { return []interface{}{acc}}, }).CoerceTo('array')") runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Branch(acc.Mod(3).Eq(0), []interface{}{row}, []interface{}{}) }, FinalEmit: func(acc r.Term) interface{} { return []interface{}{acc} }}).CoerceTo("array"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // transform/fold.yaml line #35 /* [1, 2, 3, 5, 8, 13, 21, 34, 55, 89] */ var expected_ []interface{} = []interface{}{1, 2, 3, 5, 8, 13, 21, 34, 55, 89} /* r.range(0, 10).fold([1, 1], lambda acc, row: [acc[1], acc[0].add(acc[1])], emit=lambda old,row,acc: [acc[0]]).coerce_to("array") */ suite.T().Log("About to run line #35: r.Range(0, 10).Fold([]interface{}{1, 1}, func(acc r.Term, row r.Term) interface{} { return []interface{}{acc.AtIndex(1), acc.AtIndex(0).Add(acc.AtIndex(1))}}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc.AtIndex(0)}}, }).CoerceTo('array')") runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold([]interface{}{1, 1}, func(acc r.Term, row r.Term) interface{} { return []interface{}{acc.AtIndex(1), acc.AtIndex(0).Add(acc.AtIndex(1))} }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc.AtIndex(0)} }}).CoerceTo("array"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // transform/fold.yaml line #37 /* "STREAM" */ var expected_ string = "STREAM" /* r.range(0, 10).fold(0, lambda acc, row: acc, emit=lambda old,row,acc: acc).type_of() */ suite.T().Log("About to run line #37: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return acc}, }).TypeOf()") runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return acc }}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // transform/fold.yaml line #39 /* [{'a': 0, 'id': 20}, {'a': 3, 'id': 15}, {'a': 2, 'id': 46}, {'a': 2, 'id': 78}, {'a': 2, 'id': 90}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 0, "id": 20}, map[interface{}]interface{}{"a": 3, "id": 15}, map[interface{}]interface{}{"a": 2, "id": 46}, map[interface{}]interface{}{"a": 2, "id": 78}, map[interface{}]interface{}{"a": 2, "id": 90}} /* tbl.filter("id").fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: r.branch(old.mod(20).eq(0),[row],[])).coerce_to("array") */ suite.T().Log("About to run line #39: tbl.Filter('id').Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Branch(old.Mod(20).Eq(0), []interface{}{row}, []interface{}{})}, }).CoerceTo('array')") runAndAssert(suite.Suite, expected_, tbl.Filter("id").Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Branch(old.Mod(20).Eq(0), []interface{}{row}, []interface{}{}) }}).CoerceTo("array"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // transform/fold.yaml line #42 /* [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] */ var expected_ []interface{} = []interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} /* r.range().fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [acc]).limit(10) */ suite.T().Log("About to run line #42: r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, }).Limit(10)") runAndAssert(suite.Suite, expected_, r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}).Limit(10), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // transform/fold.yaml line #45 /* 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().fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [acc]).map(lambda doc: 1).reduce(lambda l, r: l+r) */ suite.T().Log("About to run line #45: r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, }).Map(func(doc r.Term) interface{} { return 1}).Reduce(func(l r.Term, r r.Term) interface{} { return r.Add(l, r)})") runAndAssert(suite.Suite, expected_, r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}).Map(func(doc r.Term) interface{} { return 1 }).Reduce(func(l r.Term, r r.Term) interface{} { return r.Add(l, r) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #45") } { // transform/fold.yaml line #48 /* [x for x in range(1, 1001)] */ var expected_ []interface{} = (func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 1001; iterator_++ { x := iterator_ res = append(res, x) } return res }()) /* r.range(0, 1000).fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [acc]).coerce_to("array") */ suite.T().Log("About to run line #48: r.Range(0, 1000).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, }).CoerceTo('array')") runAndAssert(suite.Suite, expected_, r.Range(0, 1000).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}).CoerceTo("array"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } }
func (suite *MathLogicModSuite) TestCases() { suite.T().Log("Running MathLogicModSuite: Tests for the basic usage of the mod operation") { // math_logic/mod.yaml line #6 /* 1 */ var expected_ int = 1 /* r.expr(10) % 3 */ suite.T().Log("About to run line #6: r.Expr(10).Mod(3)") runAndAssert(suite.Suite, expected_, r.Expr(10).Mod(3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // math_logic/mod.yaml line #7 /* 1 */ var expected_ int = 1 /* 10 % r.expr(3) */ suite.T().Log("About to run line #7: r.Mod(10, r.Expr(3))") runAndAssert(suite.Suite, expected_, r.Mod(10, r.Expr(3)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // math_logic/mod.yaml line #8 /* 1 */ var expected_ int = 1 /* r.expr(10).mod(3) */ suite.T().Log("About to run line #8: r.Expr(10).Mod(3)") runAndAssert(suite.Suite, expected_, r.Expr(10).Mod(3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // math_logic/mod.yaml line #16 /* -1 */ var expected_ int = -1 /* r.expr(-10) % -3 */ suite.T().Log("About to run line #16: r.Expr(-10).Mod(-3)") runAndAssert(suite.Suite, expected_, r.Expr(-10).Mod(-3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // math_logic/mod.yaml line #22 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [1]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr(4) % 'a' */ suite.T().Log("About to run line #22: r.Expr(4).Mod('a')") runAndAssert(suite.Suite, expected_, r.Expr(4).Mod("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // math_logic/mod.yaml line #27 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('a') % 1 */ suite.T().Log("About to run line #27: r.Expr('a').Mod(1)") runAndAssert(suite.Suite, expected_, r.Expr("a").Mod(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // math_logic/mod.yaml line #32 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('a') % 'b' */ suite.T().Log("About to run line #32: r.Expr('a').Mod('b')") runAndAssert(suite.Suite, expected_, r.Expr("a").Mod("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #32") } }
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 *MathLogicAliasesSuite) TestCases() { suite.T().Log("Running MathLogicAliasesSuite: Test named aliases for math and logic operators") { // math_logic/aliases.yaml line #5 /* 1 */ var expected_ int = 1 /* r.expr(0).add(1) */ suite.T().Log("About to run line #5: r.Expr(0).Add(1)") runAndAssert(suite.Suite, expected_, r.Expr(0).Add(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // math_logic/aliases.yaml line #6 /* 1 */ var expected_ int = 1 /* r.add(0, 1) */ suite.T().Log("About to run line #6: r.Add(0, 1)") runAndAssert(suite.Suite, expected_, r.Add(0, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // math_logic/aliases.yaml line #7 /* 1 */ var expected_ int = 1 /* r.expr(2).sub(1) */ suite.T().Log("About to run line #7: r.Expr(2).Sub(1)") runAndAssert(suite.Suite, expected_, r.Expr(2).Sub(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // math_logic/aliases.yaml line #8 /* 1 */ var expected_ int = 1 /* r.sub(2, 1) */ suite.T().Log("About to run line #8: r.Sub(2, 1)") runAndAssert(suite.Suite, expected_, r.Sub(2, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // math_logic/aliases.yaml line #9 /* 1 */ var expected_ int = 1 /* r.expr(2).div(2) */ suite.T().Log("About to run line #9: r.Expr(2).Div(2)") runAndAssert(suite.Suite, expected_, r.Expr(2).Div(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // math_logic/aliases.yaml line #10 /* 1 */ var expected_ int = 1 /* r.div(2, 2) */ suite.T().Log("About to run line #10: r.Div(2, 2)") runAndAssert(suite.Suite, expected_, r.Div(2, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // math_logic/aliases.yaml line #11 /* 1 */ var expected_ int = 1 /* r.expr(1).mul(1) */ suite.T().Log("About to run line #11: r.Expr(1).Mul(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Mul(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // math_logic/aliases.yaml line #12 /* 1 */ var expected_ int = 1 /* r.mul(1, 1) */ suite.T().Log("About to run line #12: r.Mul(1, 1)") runAndAssert(suite.Suite, expected_, r.Mul(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // math_logic/aliases.yaml line #13 /* 1 */ var expected_ int = 1 /* r.expr(1).mod(2) */ suite.T().Log("About to run line #13: r.Expr(1).Mod(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Mod(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // math_logic/aliases.yaml line #14 /* 1 */ var expected_ int = 1 /* r.mod(1, 2) */ suite.T().Log("About to run line #14: r.Mod(1, 2)") runAndAssert(suite.Suite, expected_, r.Mod(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // math_logic/aliases.yaml line #25 /* True */ var expected_ bool = true /* r.expr(True).and_(True) */ suite.T().Log("About to run line #25: r.Expr(true).And(true)") runAndAssert(suite.Suite, expected_, r.Expr(true).And(true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // math_logic/aliases.yaml line #26 /* True */ var expected_ bool = true /* r.expr(True).or_(True) */ suite.T().Log("About to run line #26: r.Expr(true).Or(true)") runAndAssert(suite.Suite, expected_, r.Expr(true).Or(true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // math_logic/aliases.yaml line #27 /* True */ var expected_ bool = true /* r.and_(True, True) */ suite.T().Log("About to run line #27: r.And(true, true)") runAndAssert(suite.Suite, expected_, r.And(true, true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // math_logic/aliases.yaml line #28 /* True */ var expected_ bool = true /* r.or_(True, True) */ suite.T().Log("About to run line #28: r.Or(true, true)") runAndAssert(suite.Suite, expected_, r.Or(true, true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // math_logic/aliases.yaml line #29 /* True */ var expected_ bool = true /* r.expr(False).not_() */ suite.T().Log("About to run line #29: r.Expr(false).Not()") runAndAssert(suite.Suite, expected_, r.Expr(false).Not(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // math_logic/aliases.yaml line #30 /* True */ var expected_ bool = true /* r.not_(False) */ suite.T().Log("About to run line #30: r.Not(false)") runAndAssert(suite.Suite, expected_, r.Not(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // math_logic/aliases.yaml line #34 /* True */ var expected_ bool = true /* r.expr(1).eq(1) */ suite.T().Log("About to run line #34: r.Expr(1).Eq(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Eq(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // math_logic/aliases.yaml line #35 /* True */ var expected_ bool = true /* r.expr(1).ne(2) */ suite.T().Log("About to run line #35: r.Expr(1).Ne(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Ne(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // math_logic/aliases.yaml line #36 /* True */ var expected_ bool = true /* r.expr(1).lt(2) */ suite.T().Log("About to run line #36: r.Expr(1).Lt(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Lt(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // math_logic/aliases.yaml line #37 /* True */ var expected_ bool = true /* r.expr(1).gt(0) */ suite.T().Log("About to run line #37: r.Expr(1).Gt(0)") runAndAssert(suite.Suite, expected_, r.Expr(1).Gt(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // math_logic/aliases.yaml line #38 /* True */ var expected_ bool = true /* r.expr(1).le(1) */ suite.T().Log("About to run line #38: r.Expr(1).Le(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Le(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // math_logic/aliases.yaml line #39 /* True */ var expected_ bool = true /* r.expr(1).ge(1) */ suite.T().Log("About to run line #39: r.Expr(1).Ge(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Ge(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // math_logic/aliases.yaml line #40 /* True */ var expected_ bool = true /* r.eq(1, 1) */ suite.T().Log("About to run line #40: r.Eq(1, 1)") runAndAssert(suite.Suite, expected_, r.Eq(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // math_logic/aliases.yaml line #41 /* True */ var expected_ bool = true /* r.ne(1, 2) */ suite.T().Log("About to run line #41: r.Ne(1, 2)") runAndAssert(suite.Suite, expected_, r.Ne(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #41") } { // math_logic/aliases.yaml line #42 /* True */ var expected_ bool = true /* r.lt(1, 2) */ suite.T().Log("About to run line #42: r.Lt(1, 2)") runAndAssert(suite.Suite, expected_, r.Lt(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // math_logic/aliases.yaml line #43 /* True */ var expected_ bool = true /* r.gt(1, 0) */ suite.T().Log("About to run line #43: r.Gt(1, 0)") runAndAssert(suite.Suite, expected_, r.Gt(1, 0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // math_logic/aliases.yaml line #44 /* True */ var expected_ bool = true /* r.le(1, 1) */ suite.T().Log("About to run line #44: r.Le(1, 1)") runAndAssert(suite.Suite, expected_, r.Le(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // math_logic/aliases.yaml line #45 /* True */ var expected_ bool = true /* r.ge(1, 1) */ suite.T().Log("About to run line #45: r.Ge(1, 1)") runAndAssert(suite.Suite, expected_, r.Ge(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #45") } }