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