gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/internal/integration/reql_tests/reql_selection_test.go (about) 1 // Code generated by gen_tests.py and process_polyglot.py. 2 // Do not edit this file directly. 3 // The template for this file is located at: 4 // ../template.go.tpl 5 package reql_tests 6 7 import ( 8 "testing" 9 "time" 10 11 "github.com/stretchr/testify/suite" 12 r "gopkg.in/rethinkdb/rethinkdb-go.v6" 13 "gopkg.in/rethinkdb/rethinkdb-go.v6/internal/compare" 14 ) 15 16 // Tests that manipulation data in tables 17 func TestSelectionSuite(t *testing.T) { 18 suite.Run(t, new(SelectionSuite)) 19 } 20 21 type SelectionSuite struct { 22 suite.Suite 23 24 session *r.Session 25 } 26 27 func (suite *SelectionSuite) SetupTest() { 28 suite.T().Log("Setting up SelectionSuite") 29 // Use imports to prevent errors 30 _ = time.Time{} 31 _ = compare.AnythingIsFine 32 33 session, err := r.Connect(r.ConnectOpts{ 34 Address: url, 35 }) 36 suite.Require().NoError(err, "Error returned when connecting to server") 37 suite.session = session 38 39 r.DBDrop("test").Exec(suite.session) 40 err = r.DBCreate("test").Exec(suite.session) 41 suite.Require().NoError(err) 42 err = r.DB("test").Wait().Exec(suite.session) 43 suite.Require().NoError(err) 44 45 r.DB("test").TableDrop("tbl").Exec(suite.session) 46 err = r.DB("test").TableCreate("tbl").Exec(suite.session) 47 suite.Require().NoError(err) 48 err = r.DB("test").Table("tbl").Wait().Exec(suite.session) 49 suite.Require().NoError(err) 50 r.DB("test").TableDrop("tbl2").Exec(suite.session) 51 err = r.DB("test").TableCreate("tbl2").Exec(suite.session) 52 suite.Require().NoError(err) 53 err = r.DB("test").Table("tbl2").Wait().Exec(suite.session) 54 suite.Require().NoError(err) 55 r.DB("test").TableDrop("tbl3").Exec(suite.session) 56 err = r.DB("test").TableCreate("tbl3").Exec(suite.session) 57 suite.Require().NoError(err) 58 err = r.DB("test").Table("tbl3").Wait().Exec(suite.session) 59 suite.Require().NoError(err) 60 } 61 62 func (suite *SelectionSuite) TearDownSuite() { 63 suite.T().Log("Tearing down SelectionSuite") 64 65 if suite.session != nil { 66 r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session) 67 r.DB("test").TableDrop("tbl").Exec(suite.session) 68 r.DB("test").TableDrop("tbl2").Exec(suite.session) 69 r.DB("test").TableDrop("tbl3").Exec(suite.session) 70 r.DBDrop("test").Exec(suite.session) 71 72 suite.session.Close() 73 } 74 } 75 76 func (suite *SelectionSuite) TestCases() { 77 suite.T().Log("Running SelectionSuite: Tests that manipulation data in tables") 78 79 tbl := r.DB("test").Table("tbl") 80 _ = tbl // Prevent any noused variable errors 81 tbl2 := r.DB("test").Table("tbl2") 82 _ = tbl2 // Prevent any noused variable errors 83 tbl3 := r.DB("test").Table("tbl3") 84 _ = tbl3 // Prevent any noused variable errors 85 86 { 87 // selection.yaml line #6 88 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ 89 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} 90 /* tbl.insert([{'id':i, 'a':i%4} for i in xrange(100)]) */ 91 92 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}()))") 93 94 runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { 95 res := []interface{}{} 96 for iterator_ := 0; iterator_ < 100; iterator_++ { 97 i := iterator_ 98 res = append(res, map[interface{}]interface{}{"id": i, "a": r.Mod(i, 4)}) 99 } 100 return res 101 }())), suite.session, r.RunOpts{ 102 GeometryFormat: "raw", 103 GroupFormat: "map", 104 }) 105 suite.T().Log("Finished running line #6") 106 } 107 108 { 109 // selection.yaml line #18 110 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ 111 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} 112 /* tbl2.insert([{'id':i, 'b':i%4} for i in xrange(100)]) */ 113 114 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}()))") 115 116 runAndAssert(suite.Suite, expected_, tbl2.Insert((func() []interface{} { 117 res := []interface{}{} 118 for iterator_ := 0; iterator_ < 100; iterator_++ { 119 i := iterator_ 120 res = append(res, map[interface{}]interface{}{"id": i, "b": r.Mod(i, 4)}) 121 } 122 return res 123 }())), suite.session, r.RunOpts{ 124 GeometryFormat: "raw", 125 GroupFormat: "map", 126 }) 127 suite.T().Log("Finished running line #18") 128 } 129 130 { 131 // selection.yaml line #31 132 /* 'TABLE' */ 133 var expected_ string = "TABLE" 134 /* tbl.type_of() */ 135 136 suite.T().Log("About to run line #31: tbl.TypeOf()") 137 138 runAndAssert(suite.Suite, expected_, tbl.TypeOf(), suite.session, r.RunOpts{ 139 GeometryFormat: "raw", 140 GroupFormat: "map", 141 }) 142 suite.T().Log("Finished running line #31") 143 } 144 145 { 146 // selection.yaml line #35 147 /* err("ReqlOpFailedError", 'Database `missing` does not exist.', [0]) */ 148 var expected_ Err = err("ReqlOpFailedError", "Database `missing` does not exist.") 149 /* r.db('missing').table('bar') */ 150 151 suite.T().Log("About to run line #35: r.DB('missing').Table('bar')") 152 153 runAndAssert(suite.Suite, expected_, r.DB("missing").Table("bar"), suite.session, r.RunOpts{ 154 GeometryFormat: "raw", 155 GroupFormat: "map", 156 }) 157 suite.T().Log("Finished running line #35") 158 } 159 160 { 161 // selection.yaml line #39 162 /* err("ReqlOpFailedError", 'Table `test.missing` does not exist.', [0]) */ 163 var expected_ Err = err("ReqlOpFailedError", "Table `test.missing` does not exist.") 164 /* r.db('test').table('missing') */ 165 166 suite.T().Log("About to run line #39: r.DB('test').Table('missing')") 167 168 runAndAssert(suite.Suite, expected_, r.DB("test").Table("missing"), suite.session, r.RunOpts{ 169 GeometryFormat: "raw", 170 GroupFormat: "map", 171 }) 172 suite.T().Log("Finished running line #39") 173 } 174 175 { 176 // selection.yaml line #43 177 /* ({"errors":1,"inserted":0}) */ 178 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"errors": 1, "inserted": 0} 179 /* tbl.insert({"id":"\x00"}).pluck("errors","inserted") */ 180 181 suite.T().Log("About to run line #43: tbl.Insert(map[interface{}]interface{}{'id': '\\u0000', }).Pluck('errors', 'inserted')") 182 183 runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": "\u0000"}).Pluck("errors", "inserted"), suite.session, r.RunOpts{ 184 GeometryFormat: "raw", 185 GroupFormat: "map", 186 }) 187 suite.T().Log("Finished running line #43") 188 } 189 190 { 191 // selection.yaml line #46 192 /* ({"errors":1,"inserted":0}) */ 193 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"errors": 1, "inserted": 0} 194 /* tbl.insert({"id":["embedded",["null\x00"]]}).pluck("errors","inserted") */ 195 196 suite.T().Log("About to run line #46: tbl.Insert(map[interface{}]interface{}{'id': []interface{}{'embedded', []interface{}{'null\\u0000'}}, }).Pluck('errors', 'inserted')") 197 198 runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": []interface{}{"embedded", []interface{}{"null\u0000"}}}).Pluck("errors", "inserted"), suite.session, r.RunOpts{ 199 GeometryFormat: "raw", 200 GroupFormat: "map", 201 }) 202 suite.T().Log("Finished running line #46") 203 } 204 205 { 206 // selection.yaml line #51 207 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1}) */ 208 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} 209 /* tbl3.insert({'id':u'Здравствуй','value':u'Земля!'}) */ 210 211 suite.T().Log("About to run line #51: tbl3.Insert(map[interface{}]interface{}{'id': 'Здравствуй', 'value': 'Земля!', })") 212 213 runAndAssert(suite.Suite, expected_, tbl3.Insert(map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"}), suite.session, r.RunOpts{ 214 GeometryFormat: "raw", 215 GroupFormat: "map", 216 }) 217 suite.T().Log("Finished running line #51") 218 } 219 220 { 221 // selection.yaml line #60 222 /* {u'id':u'Здравствуй',u'value':u'Земля!'} */ 223 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"} 224 /* tbl3.get('Здравствуй') */ 225 226 suite.T().Log("About to run line #60: tbl3.Get('Здравствуй')") 227 228 runAndAssert(suite.Suite, expected_, tbl3.Get("Здравствуй"), suite.session, r.RunOpts{ 229 GeometryFormat: "raw", 230 GroupFormat: "map", 231 }) 232 suite.T().Log("Finished running line #60") 233 } 234 235 { 236 // selection.yaml line #73 237 /* [{u'id':u'Здравствуй',u'value':u'Земля!'}] */ 238 var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"}} 239 /* tbl3.filter({'value':'Земля!'}) */ 240 241 suite.T().Log("About to run line #73: tbl3.Filter(map[interface{}]interface{}{'value': 'Земля!', })") 242 243 runAndAssert(suite.Suite, expected_, tbl3.Filter(map[interface{}]interface{}{"value": "Земля!"}), suite.session, r.RunOpts{ 244 GeometryFormat: "raw", 245 GroupFormat: "map", 246 }) 247 suite.T().Log("Finished running line #73") 248 } 249 250 { 251 // selection.yaml line #86 252 /* err("ReqlQueryLogicError", 'Database name `%` invalid (Use A-Z, a-z, 0-9, _ and - only).', [0]) */ 253 var expected_ Err = err("ReqlQueryLogicError", "Database name `%` invalid (Use A-Z, a-z, 0-9, _ and - only).") 254 /* r.db('%') */ 255 256 suite.T().Log("About to run line #86: r.DB('%')") 257 258 runAndAssert(suite.Suite, expected_, r.DB("%"), suite.session, r.RunOpts{ 259 GeometryFormat: "raw", 260 GroupFormat: "map", 261 }) 262 suite.T().Log("Finished running line #86") 263 } 264 265 { 266 // selection.yaml line #89 267 /* err("ReqlQueryLogicError", 'Table name `%` invalid (Use A-Z, a-z, 0-9, _ and - only).', [0]) */ 268 var expected_ Err = err("ReqlQueryLogicError", "Table name `%` invalid (Use A-Z, a-z, 0-9, _ and - only).") 269 /* r.db('test').table('%') */ 270 271 suite.T().Log("About to run line #89: r.DB('test').Table('%')") 272 273 runAndAssert(suite.Suite, expected_, r.DB("test").Table("%"), suite.session, r.RunOpts{ 274 GeometryFormat: "raw", 275 GroupFormat: "map", 276 }) 277 suite.T().Log("Finished running line #89") 278 } 279 280 { 281 // selection.yaml line #93 282 /* 100 */ 283 var expected_ int = 100 284 /* tbl.count() */ 285 286 suite.T().Log("About to run line #93: tbl.Count()") 287 288 runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ 289 GeometryFormat: "raw", 290 GroupFormat: "map", 291 }) 292 suite.T().Log("Finished running line #93") 293 } 294 295 // selection.yaml line #97 296 // tbl2Name = tbl2.info().get_field('name') 297 suite.T().Log("Possibly executing: var tbl2Name r.Term = tbl2.Info().Field('name')") 298 299 tbl2Name := tbl2.Info().Field("name") 300 _ = tbl2Name // Prevent any noused variable errors 301 302 // selection.yaml line #98 303 // tbl2DbName = tbl2.info().get_field('db').get_field('name') 304 suite.T().Log("Possibly executing: var tbl2DbName r.Term = tbl2.Info().Field('db').Field('name')") 305 306 tbl2DbName := tbl2.Info().Field("db").Field("name") 307 _ = tbl2DbName // Prevent any noused variable errors 308 309 { 310 // selection.yaml line #101 311 /* 100 */ 312 var expected_ int = 100 313 /* r.db(tbl2DbName).table(tbl2Name, read_mode='outdated').count() */ 314 315 suite.T().Log("About to run line #101: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'outdated', }).Count()") 316 317 runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "outdated"}).Count(), suite.session, r.RunOpts{ 318 GeometryFormat: "raw", 319 GroupFormat: "map", 320 }) 321 suite.T().Log("Finished running line #101") 322 } 323 324 { 325 // selection.yaml line #102 326 /* 100 */ 327 var expected_ int = 100 328 /* r.db(tbl2DbName).table(tbl2Name, read_mode='single').count() */ 329 330 suite.T().Log("About to run line #102: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'single', }).Count()") 331 332 runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "single"}).Count(), suite.session, r.RunOpts{ 333 GeometryFormat: "raw", 334 GroupFormat: "map", 335 }) 336 suite.T().Log("Finished running line #102") 337 } 338 339 { 340 // selection.yaml line #103 341 /* 100 */ 342 var expected_ int = 100 343 /* r.db(tbl2DbName).table(tbl2Name, read_mode='majority').count() */ 344 345 suite.T().Log("About to run line #103: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'majority', }).Count()") 346 347 runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "majority"}).Count(), suite.session, r.RunOpts{ 348 GeometryFormat: "raw", 349 GroupFormat: "map", 350 }) 351 suite.T().Log("Finished running line #103") 352 } 353 354 { 355 // selection.yaml line #120 356 /* err("ReqlQueryLogicError", 'Expected type STRING but found BOOL.') */ 357 var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found BOOL.") 358 /* r.db(tbl2DbName).table(tbl2Name, read_mode=true).count() */ 359 360 suite.T().Log("About to run line #120: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: true, }).Count()") 361 362 runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: true}).Count(), suite.session, r.RunOpts{ 363 GeometryFormat: "raw", 364 GroupFormat: "map", 365 }) 366 suite.T().Log("Finished running line #120") 367 } 368 369 { 370 // selection.yaml line #125 371 /* err("ReqlQueryLogicError", 'Read mode `fake` unrecognized (options are "majority", "single", and "outdated").') */ 372 var expected_ Err = err("ReqlQueryLogicError", "Read mode `fake` unrecognized (options are \"majority\", \"single\", and \"outdated\").") 373 /* r.db(tbl2DbName).table(tbl2Name, read_mode='fake').count() */ 374 375 suite.T().Log("About to run line #125: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'fake', }).Count()") 376 377 runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "fake"}).Count(), suite.session, r.RunOpts{ 378 GeometryFormat: "raw", 379 GroupFormat: "map", 380 }) 381 suite.T().Log("Finished running line #125") 382 } 383 384 { 385 // selection.yaml line #130 386 /* 2 */ 387 var expected_ int = 2 388 /* tbl.get(20).count() */ 389 390 suite.T().Log("About to run line #130: tbl.Get(20).Count()") 391 392 runAndAssert(suite.Suite, expected_, tbl.Get(20).Count(), suite.session, r.RunOpts{ 393 GeometryFormat: "raw", 394 GroupFormat: "map", 395 }) 396 suite.T().Log("Finished running line #130") 397 } 398 399 { 400 // selection.yaml line #134 401 /* {'id':20,'a':0} */ 402 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 20, "a": 0} 403 /* tbl.get(20) */ 404 405 suite.T().Log("About to run line #134: tbl.Get(20)") 406 407 runAndAssert(suite.Suite, expected_, tbl.Get(20), suite.session, r.RunOpts{ 408 GeometryFormat: "raw", 409 GroupFormat: "map", 410 }) 411 suite.T().Log("Finished running line #134") 412 } 413 414 { 415 // selection.yaml line #138 416 /* null */ 417 var expected_ interface{} = nil 418 /* tbl.get(2000) */ 419 420 suite.T().Log("About to run line #138: tbl.Get(2000)") 421 422 runAndAssert(suite.Suite, expected_, tbl.Get(2000), suite.session, r.RunOpts{ 423 GeometryFormat: "raw", 424 GroupFormat: "map", 425 }) 426 suite.T().Log("Finished running line #138") 427 } 428 429 // selection.yaml line #153 430 // tblpkey = r.db('test').table('testpkey') 431 suite.T().Log("Possibly executing: var tblpkey r.Term = r.DB('test').Table('testpkey')") 432 433 tblpkey := r.DB("test").Table("testpkey") 434 _ = tblpkey // Prevent any noused variable errors 435 436 { 437 // selection.yaml line #149 438 /* partial({'tables_created':1}) */ 439 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 440 /* r.db('test').table_create('testpkey', primary_key='foo') */ 441 442 suite.T().Log("About to run line #149: r.DB('test').TableCreate('testpkey').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })") 443 444 runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("testpkey").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{ 445 GeometryFormat: "raw", 446 GroupFormat: "map", 447 }) 448 suite.T().Log("Finished running line #149") 449 } 450 451 { 452 // selection.yaml line #155 453 /* {'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1} */ 454 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} 455 /* tblpkey.insert({'foo':10,'a':10}) */ 456 457 suite.T().Log("About to run line #155: tblpkey.Insert(map[interface{}]interface{}{'foo': 10, 'a': 10, })") 458 459 runAndAssert(suite.Suite, expected_, tblpkey.Insert(map[interface{}]interface{}{"foo": 10, "a": 10}), suite.session, r.RunOpts{ 460 GeometryFormat: "raw", 461 GroupFormat: "map", 462 }) 463 suite.T().Log("Finished running line #155") 464 } 465 466 { 467 // selection.yaml line #159 468 /* {'foo':10,'a':10} */ 469 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"foo": 10, "a": 10} 470 /* tblpkey.get(10) */ 471 472 suite.T().Log("About to run line #159: tblpkey.Get(10)") 473 474 runAndAssert(suite.Suite, expected_, tblpkey.Get(10), suite.session, r.RunOpts{ 475 GeometryFormat: "raw", 476 GroupFormat: "map", 477 }) 478 suite.T().Log("Finished running line #159") 479 } 480 481 { 482 // selection.yaml line #163 483 /* [] */ 484 var expected_ []interface{} = []interface{}{} 485 /* tbl.get_all() */ 486 487 suite.T().Log("About to run line #163: tbl.GetAll()") 488 489 runAndAssert(suite.Suite, expected_, tbl.GetAll(), suite.session, r.RunOpts{ 490 GeometryFormat: "raw", 491 GroupFormat: "map", 492 }) 493 suite.T().Log("Finished running line #163") 494 } 495 496 { 497 // selection.yaml line #165 498 /* [{"id":20,"a":0}] */ 499 var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 20, "a": 0}} 500 /* tbl.get_all(20) */ 501 502 suite.T().Log("About to run line #165: tbl.GetAll(20)") 503 504 runAndAssert(suite.Suite, expected_, tbl.GetAll(20), suite.session, r.RunOpts{ 505 GeometryFormat: "raw", 506 GroupFormat: "map", 507 }) 508 suite.T().Log("Finished running line #165") 509 } 510 511 { 512 // selection.yaml line #167 513 /* "SELECTION<STREAM>" */ 514 var expected_ string = "SELECTION<STREAM>" 515 /* tbl.get_all().type_of() */ 516 517 suite.T().Log("About to run line #167: tbl.GetAll().TypeOf()") 518 519 runAndAssert(suite.Suite, expected_, tbl.GetAll().TypeOf(), suite.session, r.RunOpts{ 520 GeometryFormat: "raw", 521 GroupFormat: "map", 522 }) 523 suite.T().Log("Finished running line #167") 524 } 525 526 { 527 // selection.yaml line #169 528 /* "SELECTION<STREAM>" */ 529 var expected_ string = "SELECTION<STREAM>" 530 /* tbl.get_all(20).type_of() */ 531 532 suite.T().Log("About to run line #169: tbl.GetAll(20).TypeOf()") 533 534 runAndAssert(suite.Suite, expected_, tbl.GetAll(20).TypeOf(), suite.session, r.RunOpts{ 535 GeometryFormat: "raw", 536 GroupFormat: "map", 537 }) 538 suite.T().Log("Finished running line #169") 539 } 540 541 { 542 // selection.yaml line #173 543 /* 'TABLE_SLICE' */ 544 var expected_ string = "TABLE_SLICE" 545 /* tbl.between(2, 1).type_of() */ 546 547 suite.T().Log("About to run line #173: tbl.Between(2, 1).TypeOf()") 548 549 runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).TypeOf(), suite.session, r.RunOpts{ 550 GeometryFormat: "raw", 551 GroupFormat: "map", 552 }) 553 suite.T().Log("Finished running line #173") 554 } 555 556 { 557 // selection.yaml line #175 558 /* 'TABLE_SLICE' */ 559 var expected_ string = "TABLE_SLICE" 560 /* tbl.between(1, 2).type_of() */ 561 562 suite.T().Log("About to run line #175: tbl.Between(1, 2).TypeOf()") 563 564 runAndAssert(suite.Suite, expected_, tbl.Between(1, 2).TypeOf(), suite.session, r.RunOpts{ 565 GeometryFormat: "raw", 566 GroupFormat: "map", 567 }) 568 suite.T().Log("Finished running line #175") 569 } 570 571 { 572 // selection.yaml line #177 573 /* 'TABLE_SLICE' */ 574 var expected_ string = "TABLE_SLICE" 575 /* tbl.between(1, 2, index='id').type_of() */ 576 577 suite.T().Log("About to run line #177: tbl.Between(1, 2).OptArgs(r.BetweenOpts{Index: 'id', }).TypeOf()") 578 579 runAndAssert(suite.Suite, expected_, tbl.Between(1, 2).OptArgs(r.BetweenOpts{Index: "id"}).TypeOf(), suite.session, r.RunOpts{ 580 GeometryFormat: "raw", 581 GroupFormat: "map", 582 }) 583 suite.T().Log("Finished running line #177") 584 } 585 586 { 587 // selection.yaml line #181 588 /* 'TABLE_SLICE' */ 589 var expected_ string = "TABLE_SLICE" 590 /* tbl.between(1, 1, right_bound='closed').type_of() */ 591 592 suite.T().Log("About to run line #181: tbl.Between(1, 1).OptArgs(r.BetweenOpts{RightBound: 'closed', }).TypeOf()") 593 594 runAndAssert(suite.Suite, expected_, tbl.Between(1, 1).OptArgs(r.BetweenOpts{RightBound: "closed"}).TypeOf(), suite.session, r.RunOpts{ 595 GeometryFormat: "raw", 596 GroupFormat: "map", 597 }) 598 suite.T().Log("Finished running line #181") 599 } 600 601 { 602 // selection.yaml line #185 603 /* 'TABLE_SLICE' */ 604 var expected_ string = "TABLE_SLICE" 605 /* tbl.between(2, 1).type_of() */ 606 607 suite.T().Log("About to run line #185: tbl.Between(2, 1).TypeOf()") 608 609 runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).TypeOf(), suite.session, r.RunOpts{ 610 GeometryFormat: "raw", 611 GroupFormat: "map", 612 }) 613 suite.T().Log("Finished running line #185") 614 } 615 616 { 617 // selection.yaml line #187 618 /* 'TABLE_SLICE' */ 619 var expected_ string = "TABLE_SLICE" 620 /* tbl.between(2, 1, index='id').type_of() */ 621 622 suite.T().Log("About to run line #187: tbl.Between(2, 1).OptArgs(r.BetweenOpts{Index: 'id', }).TypeOf()") 623 624 runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).OptArgs(r.BetweenOpts{Index: "id"}).TypeOf(), suite.session, r.RunOpts{ 625 GeometryFormat: "raw", 626 GroupFormat: "map", 627 }) 628 suite.T().Log("Finished running line #187") 629 } 630 631 { 632 // selection.yaml line #192 633 /* 0 */ 634 var expected_ int = 0 635 /* tbl.between(21, 20).count() */ 636 637 suite.T().Log("About to run line #192: tbl.Between(21, 20).Count()") 638 639 runAndAssert(suite.Suite, expected_, tbl.Between(21, 20).Count(), suite.session, r.RunOpts{ 640 GeometryFormat: "raw", 641 GroupFormat: "map", 642 }) 643 suite.T().Log("Finished running line #192") 644 } 645 646 { 647 // selection.yaml line #194 648 /* 9 */ 649 var expected_ int = 9 650 /* tbl.between(20, 29).count() */ 651 652 suite.T().Log("About to run line #194: tbl.Between(20, 29).Count()") 653 654 runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).Count(), suite.session, r.RunOpts{ 655 GeometryFormat: "raw", 656 GroupFormat: "map", 657 }) 658 suite.T().Log("Finished running line #194") 659 } 660 661 { 662 // selection.yaml line #196 663 /* 9 */ 664 var expected_ int = 9 665 /* tbl.between(-10, 9).count() */ 666 667 suite.T().Log("About to run line #196: tbl.Between(-10, 9).Count()") 668 669 runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).Count(), suite.session, r.RunOpts{ 670 GeometryFormat: "raw", 671 GroupFormat: "map", 672 }) 673 suite.T().Log("Finished running line #196") 674 } 675 676 { 677 // selection.yaml line #198 678 /* 20 */ 679 var expected_ int = 20 680 /* tbl.between(80, 2000).count() */ 681 682 suite.T().Log("About to run line #198: tbl.Between(80, 2000).Count()") 683 684 runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).Count(), suite.session, r.RunOpts{ 685 GeometryFormat: "raw", 686 GroupFormat: "map", 687 }) 688 suite.T().Log("Finished running line #198") 689 } 690 691 { 692 // selection.yaml line #200 693 /* 100 */ 694 var expected_ int = 100 695 /* tbl.between(-2000, 2000).count() */ 696 697 suite.T().Log("About to run line #200: tbl.Between(-2000, 2000).Count()") 698 699 runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).Count(), suite.session, r.RunOpts{ 700 GeometryFormat: "raw", 701 GroupFormat: "map", 702 }) 703 suite.T().Log("Finished running line #200") 704 } 705 706 { 707 // selection.yaml line #205 708 /* 10 */ 709 var expected_ int = 10 710 /* tbl.between(20, 29, right_bound='closed').count() */ 711 712 suite.T().Log("About to run line #205: tbl.Between(20, 29).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") 713 714 runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 715 GeometryFormat: "raw", 716 GroupFormat: "map", 717 }) 718 suite.T().Log("Finished running line #205") 719 } 720 721 { 722 // selection.yaml line #209 723 /* 10 */ 724 var expected_ int = 10 725 /* tbl.between(-10, 9, right_bound='closed').count() */ 726 727 suite.T().Log("About to run line #209: tbl.Between(-10, 9).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") 728 729 runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 730 GeometryFormat: "raw", 731 GroupFormat: "map", 732 }) 733 suite.T().Log("Finished running line #209") 734 } 735 736 { 737 // selection.yaml line #213 738 /* 20 */ 739 var expected_ int = 20 740 /* tbl.between(80, 2000, right_bound='closed').count() */ 741 742 suite.T().Log("About to run line #213: tbl.Between(80, 2000).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") 743 744 runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 745 GeometryFormat: "raw", 746 GroupFormat: "map", 747 }) 748 suite.T().Log("Finished running line #213") 749 } 750 751 { 752 // selection.yaml line #217 753 /* 100 */ 754 var expected_ int = 100 755 /* tbl.between(-2000, 2000, right_bound='closed').count() */ 756 757 suite.T().Log("About to run line #217: tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") 758 759 runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 760 GeometryFormat: "raw", 761 GroupFormat: "map", 762 }) 763 suite.T().Log("Finished running line #217") 764 } 765 766 { 767 // selection.yaml line #223 768 /* 8 */ 769 var expected_ int = 8 770 /* tbl.between(20, 29, left_bound='open').count() */ 771 772 suite.T().Log("About to run line #223: tbl.Between(20, 29).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") 773 774 runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ 775 GeometryFormat: "raw", 776 GroupFormat: "map", 777 }) 778 suite.T().Log("Finished running line #223") 779 } 780 781 { 782 // selection.yaml line #227 783 /* 9 */ 784 var expected_ int = 9 785 /* tbl.between(-10, 9, left_bound='open').count() */ 786 787 suite.T().Log("About to run line #227: tbl.Between(-10, 9).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") 788 789 runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ 790 GeometryFormat: "raw", 791 GroupFormat: "map", 792 }) 793 suite.T().Log("Finished running line #227") 794 } 795 796 { 797 // selection.yaml line #231 798 /* 19 */ 799 var expected_ int = 19 800 /* tbl.between(80, 2000, left_bound='open').count() */ 801 802 suite.T().Log("About to run line #231: tbl.Between(80, 2000).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") 803 804 runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ 805 GeometryFormat: "raw", 806 GroupFormat: "map", 807 }) 808 suite.T().Log("Finished running line #231") 809 } 810 811 { 812 // selection.yaml line #235 813 /* 100 */ 814 var expected_ int = 100 815 /* tbl.between(-2000, 2000, left_bound='open').count() */ 816 817 suite.T().Log("About to run line #235: tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") 818 819 runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ 820 GeometryFormat: "raw", 821 GroupFormat: "map", 822 }) 823 suite.T().Log("Finished running line #235") 824 } 825 826 { 827 // selection.yaml line #240 828 /* err('ReqlQueryLogicError', 'Expected type TABLE_SLICE but found DATUM:', [0]) */ 829 var expected_ Err = err("ReqlQueryLogicError", "Expected type TABLE_SLICE but found DATUM:") 830 /* r.expr([1, 2, 3]).between(-1, 2) */ 831 832 suite.T().Log("About to run line #240: r.Expr([]interface{}{1, 2, 3}).Between(-1, 2)") 833 834 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Between(-1, 2), suite.session, r.RunOpts{ 835 GeometryFormat: "raw", 836 GroupFormat: "map", 837 }) 838 suite.T().Log("Finished running line #240") 839 } 840 841 { 842 // selection.yaml line #244 843 /* 2 */ 844 var expected_ int = 2 845 /* tbl.between(r.minval, 2).count() */ 846 847 suite.T().Log("About to run line #244: tbl.Between(r.MinVal, 2).Count()") 848 849 runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).Count(), suite.session, r.RunOpts{ 850 GeometryFormat: "raw", 851 GroupFormat: "map", 852 }) 853 suite.T().Log("Finished running line #244") 854 } 855 856 { 857 // selection.yaml line #247 858 /* 3 */ 859 var expected_ int = 3 860 /* tbl.between(r.minval, 2, right_bound='closed').count() */ 861 862 suite.T().Log("About to run line #247: tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") 863 864 runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 865 GeometryFormat: "raw", 866 GroupFormat: "map", 867 }) 868 suite.T().Log("Finished running line #247") 869 } 870 871 { 872 // selection.yaml line #251 873 /* 2 */ 874 var expected_ int = 2 875 /* tbl.between(r.minval, 2, left_bound='open').count() */ 876 877 suite.T().Log("About to run line #251: tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") 878 879 runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ 880 GeometryFormat: "raw", 881 GroupFormat: "map", 882 }) 883 suite.T().Log("Finished running line #251") 884 } 885 886 { 887 // selection.yaml line #255 888 /* 98 */ 889 var expected_ int = 98 890 /* tbl.between(2, r.maxval).count() */ 891 892 suite.T().Log("About to run line #255: tbl.Between(2, r.MaxVal).Count()") 893 894 runAndAssert(suite.Suite, expected_, tbl.Between(2, r.MaxVal).Count(), suite.session, r.RunOpts{ 895 GeometryFormat: "raw", 896 GroupFormat: "map", 897 }) 898 suite.T().Log("Finished running line #255") 899 } 900 901 { 902 // selection.yaml line #265 903 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ 904 var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") 905 /* tbl.between(null, 2).count() */ 906 907 suite.T().Log("About to run line #265: tbl.Between(nil, 2).Count()") 908 909 runAndAssert(suite.Suite, expected_, tbl.Between(nil, 2).Count(), suite.session, r.RunOpts{ 910 GeometryFormat: "raw", 911 GroupFormat: "map", 912 }) 913 suite.T().Log("Finished running line #265") 914 } 915 916 { 917 // selection.yaml line #266 918 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ 919 var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") 920 /* tbl.between(2, null).count() */ 921 922 suite.T().Log("About to run line #266: tbl.Between(2, nil).Count()") 923 924 runAndAssert(suite.Suite, expected_, tbl.Between(2, nil).Count(), suite.session, r.RunOpts{ 925 GeometryFormat: "raw", 926 GroupFormat: "map", 927 }) 928 suite.T().Log("Finished running line #266") 929 } 930 931 { 932 // selection.yaml line #267 933 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ 934 var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") 935 /* tbl.between(null, null).count() */ 936 937 suite.T().Log("About to run line #267: tbl.Between(nil, nil).Count()") 938 939 runAndAssert(suite.Suite, expected_, tbl.Between(nil, nil).Count(), suite.session, r.RunOpts{ 940 GeometryFormat: "raw", 941 GroupFormat: "map", 942 }) 943 suite.T().Log("Finished running line #267") 944 } 945 946 { 947 // selection.yaml line #271 948 /* 1 */ 949 var expected_ int = 1 950 /* tblpkey.between(9, 11).count() */ 951 952 suite.T().Log("About to run line #271: tblpkey.Between(9, 11).Count()") 953 954 runAndAssert(suite.Suite, expected_, tblpkey.Between(9, 11).Count(), suite.session, r.RunOpts{ 955 GeometryFormat: "raw", 956 GroupFormat: "map", 957 }) 958 suite.T().Log("Finished running line #271") 959 } 960 961 { 962 // selection.yaml line #274 963 /* 0 */ 964 var expected_ int = 0 965 /* tblpkey.between(11, 12).count() */ 966 967 suite.T().Log("About to run line #274: tblpkey.Between(11, 12).Count()") 968 969 runAndAssert(suite.Suite, expected_, tblpkey.Between(11, 12).Count(), suite.session, r.RunOpts{ 970 GeometryFormat: "raw", 971 GroupFormat: "map", 972 }) 973 suite.T().Log("Finished running line #274") 974 } 975 976 { 977 // selection.yaml line #278 978 /* 25 */ 979 var expected_ int = 25 980 /* tbl.filter(lambda row:row['a'] > 2).count() */ 981 982 suite.T().Log("About to run line #278: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Gt(2)}).Count()") 983 984 runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Gt(2) }).Count(), suite.session, r.RunOpts{ 985 GeometryFormat: "raw", 986 GroupFormat: "map", 987 }) 988 suite.T().Log("Finished running line #278") 989 } 990 991 { 992 // selection.yaml line #284 993 /* 100 */ 994 var expected_ int = 100 995 /* tbl.filter(lambda row: 1).count() */ 996 997 suite.T().Log("About to run line #284: tbl.Filter(func(row r.Term) interface{} { return 1}).Count()") 998 999 runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return 1 }).Count(), suite.session, r.RunOpts{ 1000 GeometryFormat: "raw", 1001 GroupFormat: "map", 1002 }) 1003 suite.T().Log("Finished running line #284") 1004 } 1005 1006 { 1007 // selection.yaml line #290 1008 /* [4, 5] */ 1009 var expected_ []interface{} = []interface{}{4, 5} 1010 /* r.expr([1, 2, 3, 4, 5]).filter(r.row > 2).filter(r.row > 3) */ 1011 1012 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))") 1013 1014 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{ 1015 GeometryFormat: "raw", 1016 GroupFormat: "map", 1017 }) 1018 suite.T().Log("Finished running line #290") 1019 } 1020 1021 // selection.yaml line #296 1022 // nested = r.expr([[1, 2], [3, 4], [5, 6]]) 1023 suite.T().Log("Possibly executing: var nested r.Term = r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}})") 1024 1025 nested := r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}}) 1026 _ = nested // Prevent any noused variable errors 1027 1028 { 1029 // selection.yaml line #298 1030 /* [[3, 4], [5, 6]] */ 1031 var expected_ []interface{} = []interface{}{[]interface{}{3, 4}, []interface{}{5, 6}} 1032 /* nested.filter(lambda x: x.filter(lambda y: y >= 4).count() > 0) */ 1033 1034 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)})") 1035 1036 runAndAssert(suite.Suite, expected_, nested.Filter(func(x r.Term) interface{} { 1037 return x.Filter(func(y r.Term) interface{} { return r.Ge(y, 4) }).Count().Gt(0) 1038 }), suite.session, r.RunOpts{ 1039 GeometryFormat: "raw", 1040 GroupFormat: "map", 1041 }) 1042 suite.T().Log("Finished running line #298") 1043 } 1044 1045 { 1046 // selection.yaml line #303 1047 /* ([[3, 4], [5, 6]]) */ 1048 var expected_ []interface{} = []interface{}{[]interface{}{3, 4}, []interface{}{5, 6}} 1049 /* nested.filter(r.row.filter(lambda y: y >= 4).count() > 0) */ 1050 1051 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))") 1052 1053 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{ 1054 GeometryFormat: "raw", 1055 GroupFormat: "map", 1056 }) 1057 suite.T().Log("Finished running line #303") 1058 } 1059 1060 { 1061 // selection.yaml line #307 1062 /* err("ReqlCompileError", 'Cannot use r.row in nested queries. Use functions instead.', [0]) */ 1063 var expected_ Err = err("ReqlCompileError", "Cannot use r.row in nested queries. Use functions instead.") 1064 /* nested.filter(lambda x: x.filter(r.row >= 4).count() > 0) */ 1065 1066 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)})") 1067 1068 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{ 1069 GeometryFormat: "raw", 1070 GroupFormat: "map", 1071 }) 1072 suite.T().Log("Finished running line #307") 1073 } 1074 1075 { 1076 // selection.yaml line #311 1077 /* err("ReqlCompileError", 'Cannot use r.row in nested queries. Use functions instead.', [0]) */ 1078 var expected_ Err = err("ReqlCompileError", "Cannot use r.row in nested queries. Use functions instead.") 1079 /* r.expr([[1, 2], [3, 4], [5, 6]]).filter(r.row.filter(r.row >= 4).count() > 0) */ 1080 1081 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))") 1082 1083 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{ 1084 GeometryFormat: "raw", 1085 GroupFormat: "map", 1086 }) 1087 suite.T().Log("Finished running line #311") 1088 } 1089 1090 { 1091 // selection.yaml line #316 1092 /* [{'a':1,'b':2,'c':3}] */ 1093 var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}} 1094 /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':1,'b':2}) */ 1095 1096 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, })") 1097 1098 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{ 1099 GeometryFormat: "raw", 1100 GroupFormat: "map", 1101 }) 1102 suite.T().Log("Finished running line #316") 1103 } 1104 1105 { 1106 // selection.yaml line #319 1107 /* [{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}] */ 1108 var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}} 1109 /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':1}) */ 1110 1111 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, })") 1112 1113 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{ 1114 GeometryFormat: "raw", 1115 GroupFormat: "map", 1116 }) 1117 suite.T().Log("Finished running line #319") 1118 } 1119 1120 { 1121 // selection.yaml line #323 1122 /* [{'a':1,'b':1,'c':3}] */ 1123 var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}} 1124 /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':r.row['b']}) */ 1125 1126 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'), })") 1127 1128 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{ 1129 GeometryFormat: "raw", 1130 GroupFormat: "map", 1131 }) 1132 suite.T().Log("Finished running line #323") 1133 } 1134 1135 { 1136 // selection.yaml line #329 1137 /* [] */ 1138 var expected_ []interface{} = []interface{}{} 1139 /* r.expr([{'a':1}]).filter({'b':1}) */ 1140 1141 suite.T().Log("About to run line #329: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }}).Filter(map[interface{}]interface{}{'b': 1, })") 1142 1143 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}}).Filter(map[interface{}]interface{}{"b": 1}), suite.session, r.RunOpts{ 1144 GeometryFormat: "raw", 1145 GroupFormat: "map", 1146 }) 1147 suite.T().Log("Finished running line #329") 1148 } 1149 1150 { 1151 // selection.yaml line #335 1152 /* 25 */ 1153 var expected_ int = 25 1154 /* tbl.count(lambda row: {'a':1}) */ 1155 1156 suite.T().Log("About to run line #335: tbl.Count(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': 1, }})") 1157 1158 runAndAssert(suite.Suite, expected_, tbl.Count(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": 1} }), suite.session, r.RunOpts{ 1159 GeometryFormat: "raw", 1160 GroupFormat: "map", 1161 }) 1162 suite.T().Log("Finished running line #335") 1163 } 1164 1165 { 1166 // selection.yaml line #341 1167 /* 2 */ 1168 var expected_ int = 2 1169 /* r.expr([1,2,3,1]).count(1) */ 1170 1171 suite.T().Log("About to run line #341: r.Expr([]interface{}{1, 2, 3, 1}).Count(1)") 1172 1173 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 1}).Count(1), suite.session, r.RunOpts{ 1174 GeometryFormat: "raw", 1175 GroupFormat: "map", 1176 }) 1177 suite.T().Log("Finished running line #341") 1178 } 1179 1180 { 1181 // selection.yaml line #344 1182 /* 2 */ 1183 var expected_ int = 2 1184 /* r.expr([null, 4, null, 'foo']).count(null) */ 1185 1186 suite.T().Log("About to run line #344: r.Expr([]interface{}{nil, 4, nil, 'foo'}).Count(nil)") 1187 1188 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{nil, 4, nil, "foo"}).Count(nil), suite.session, r.RunOpts{ 1189 GeometryFormat: "raw", 1190 GroupFormat: "map", 1191 }) 1192 suite.T().Log("Finished running line #344") 1193 } 1194 1195 { 1196 // selection.yaml line #348 1197 /* err('ReqlQueryLogicError', 'Expected type DATUM but found TABLE:', [0]) */ 1198 var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:") 1199 /* r.expr(5) + tbl */ 1200 1201 suite.T().Log("About to run line #348: r.Expr(5).Add(tbl)") 1202 1203 runAndAssert(suite.Suite, expected_, r.Expr(5).Add(tbl), suite.session, r.RunOpts{ 1204 GeometryFormat: "raw", 1205 GroupFormat: "map", 1206 }) 1207 suite.T().Log("Finished running line #348") 1208 } 1209 1210 { 1211 // selection.yaml line #353 1212 /* "SELECTION<STREAM>" */ 1213 var expected_ string = "SELECTION<STREAM>" 1214 /* tbl.has_fields('field').type_of() */ 1215 1216 suite.T().Log("About to run line #353: tbl.HasFields('field').TypeOf()") 1217 1218 runAndAssert(suite.Suite, expected_, tbl.HasFields("field").TypeOf(), suite.session, r.RunOpts{ 1219 GeometryFormat: "raw", 1220 GroupFormat: "map", 1221 }) 1222 suite.T().Log("Finished running line #353") 1223 } 1224 }