| 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 | // secondary indexes on times |
| 17 | func TestTimesIndexSuite(t *testing.T) { |
| 18 | suite.Run(t, new(TimesIndexSuite)) |
| 19 | } |
| 20 | |
| 21 | type TimesIndexSuite struct { |
| 22 | suite.Suite |
| 23 | |
| 24 | session *r.Session |
| 25 | } |
| 26 | |
| 27 | func (suite *TimesIndexSuite) SetupTest() { |
| 28 | suite.T().Log("Setting up TimesIndexSuite") |
| 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_times_idx").Exec(suite.session) |
| 40 | err = r.DBCreate("db_times_idx").Exec(suite.session) |
| 41 | suite.Require().NoError(err) |
| 42 | err = r.DB("db_times_idx").Wait().Exec(suite.session) |
| 43 | suite.Require().NoError(err) |
| 44 | |
| 45 | r.DB("db_times_idx").TableDrop("table_test_times_index").Exec(suite.session) |
| 46 | err = r.DB("db_times_idx").TableCreate("table_test_times_index").Exec(suite.session) |
| 47 | suite.Require().NoError(err) |
| 48 | err = r.DB("db_times_idx").Table("table_test_times_index").Wait().Exec(suite.session) |
| 49 | suite.Require().NoError(err) |
| 50 | } |
| 51 | |
| 52 | func (suite *TimesIndexSuite) TearDownSuite() { |
| 53 | suite.T().Log("Tearing down TimesIndexSuite") |
| 54 | |
| 55 | if suite.session != nil { |
| 56 | r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session) |
| 57 | r.DB("db_times_idx").TableDrop("table_test_times_index").Exec(suite.session) |
| 58 | r.DBDrop("db_times_idx").Exec(suite.session) |
| 59 | |
| 60 | suite.session.Close() |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | func (suite *TimesIndexSuite) TestCases() { |
| 65 | suite.T().Log("Running TimesIndexSuite: secondary indexes on times") |
| 66 | |
| 67 | table_test_times_index := r.DB("db_times_idx").Table("table_test_times_index") |
| 68 | _ = table_test_times_index // Prevent any noused variable errors |
| 69 | |
| 70 | // times/index.yaml line #7 |
| 71 | // ts={"timezone":"-07:00","epoch_time":1375445162.0872,"$reql_type$":"TIME"} |
| 72 | suite.T().Log("Possibly executing: var ts map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445162.0872, '$reql_type$': 'TIME', }") |
| 73 | |
| 74 | ts := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445162.0872, "$reql_type$": "TIME"} |
| 75 | _ = ts // Prevent any noused variable errors |
| 76 | |
| 77 | // times/index.yaml line #11 |
| 78 | // t1={"timezone":"-07:00","epoch_time":1375445163.0872,"$reql_type$":"TIME"} |
| 79 | suite.T().Log("Possibly executing: var t1 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.0872, '$reql_type$': 'TIME', }") |
| 80 | |
| 81 | t1 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.0872, "$reql_type$": "TIME"} |
| 82 | _ = t1 // Prevent any noused variable errors |
| 83 | |
| 84 | // times/index.yaml line #15 |
| 85 | // t2={"timezone":"-07:00","epoch_time":1375445163.08832,"$reql_type$":"TIME"} |
| 86 | suite.T().Log("Possibly executing: var t2 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.08832, '$reql_type$': 'TIME', }") |
| 87 | |
| 88 | t2 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.08832, "$reql_type$": "TIME"} |
| 89 | _ = t2 // Prevent any noused variable errors |
| 90 | |
| 91 | // times/index.yaml line #19 |
| 92 | // t3={"timezone":"-07:00","epoch_time":1375445163.08943,"$reql_type$":"TIME"} |
| 93 | suite.T().Log("Possibly executing: var t3 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.08943, '$reql_type$': 'TIME', }") |
| 94 | |
| 95 | t3 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.08943, "$reql_type$": "TIME"} |
| 96 | _ = t3 // Prevent any noused variable errors |
| 97 | |
| 98 | // times/index.yaml line #23 |
| 99 | // t4={"timezone":"-07:00","epoch_time":1375445163.09055,"$reql_type$":"TIME"} |
| 100 | suite.T().Log("Possibly executing: var t4 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.09055, '$reql_type$': 'TIME', }") |
| 101 | |
| 102 | t4 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.09055, "$reql_type$": "TIME"} |
| 103 | _ = t4 // Prevent any noused variable errors |
| 104 | |
| 105 | // times/index.yaml line #27 |
| 106 | // t5={"timezone":"-07:00","epoch_time":1375445163.09166,"$reql_type$":"TIME"} |
| 107 | suite.T().Log("Possibly executing: var t5 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.09166, '$reql_type$': 'TIME', }") |
| 108 | |
| 109 | t5 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.09166, "$reql_type$": "TIME"} |
| 110 | _ = t5 // Prevent any noused variable errors |
| 111 | |
| 112 | // times/index.yaml line #31 |
| 113 | // te={"timezone":"-07:00","epoch_time":1375445164.0872,"$reql_type$":"TIME"} |
| 114 | suite.T().Log("Possibly executing: var te map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445164.0872, '$reql_type$': 'TIME', }") |
| 115 | |
| 116 | te := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445164.0872, "$reql_type$": "TIME"} |
| 117 | _ = te // Prevent any noused variable errors |
| 118 | |
| 119 | // times/index.yaml line #36 |
| 120 | // trows = [{'id':t1}, {'id':t2}, {'id':t3}, {'id':t4}, {'id':t5}] |
| 121 | suite.T().Log("Possibly executing: var trows []interface{} = []interface{}{map[interface{}]interface{}{'id': t1, }, map[interface{}]interface{}{'id': t2, }, map[interface{}]interface{}{'id': t3, }, map[interface{}]interface{}{'id': t4, }, map[interface{}]interface{}{'id': t5, }}") |
| 122 | |
| 123 | trows := []interface{}{map[interface{}]interface{}{"id": t1}, map[interface{}]interface{}{"id": t2}, map[interface{}]interface{}{"id": t3}, map[interface{}]interface{}{"id": t4}, map[interface{}]interface{}{"id": t5}} |
| 124 | _ = trows // Prevent any noused variable errors |
| 125 | |
| 126 | { |
| 127 | // times/index.yaml line #37 |
| 128 | /* 5 */ |
| 129 | var expected_ int = 5 |
| 130 | /* table_test_times_index.insert(trows)['inserted'] */ |
| 131 | |
| 132 | suite.T().Log("About to run line #37: table_test_times_index.Insert(trows).AtIndex('inserted')") |
| 133 | |
| 134 | runAndAssert(suite.Suite, expected_, table_test_times_index.Insert(trows).AtIndex("inserted"), suite.session, r.RunOpts{ |
| 135 | GeometryFormat: "raw", |
| 136 | GroupFormat: "map", |
| 137 | }) |
| 138 | suite.T().Log("Finished running line #37") |
| 139 | } |
| 140 | |
| 141 | // times/index.yaml line #41 |
| 142 | // bad_insert = [{'id':r.expr(t1).in_timezone("Z")}] |
| 143 | suite.T().Log("Possibly executing: var bad_insert []interface{} = []interface{}{map[interface{}]interface{}{'id': r.Expr(t1).InTimezone('Z'), }}") |
| 144 | |
| 145 | bad_insert := []interface{}{map[interface{}]interface{}{"id": r.Expr(t1).InTimezone("Z")}} |
| 146 | _ = bad_insert // Prevent any noused variable errors |
| 147 | |
| 148 | { |
| 149 | // times/index.yaml line #42 |
| 150 | /* ("Duplicate primary key `id`:\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"-07:00\"\n\t}\n}\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"+00:00\"\n\t}\n}") */ |
| 151 | var expected_ string = "Duplicate primary key `id`:\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"-07:00\"\n\t}\n}\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"+00:00\"\n\t}\n}" |
| 152 | /* table_test_times_index.insert(bad_insert)['first_error'] */ |
| 153 | |
| 154 | suite.T().Log("About to run line #42: table_test_times_index.Insert(bad_insert).AtIndex('first_error')") |
| 155 | |
| 156 | runAndAssert(suite.Suite, expected_, table_test_times_index.Insert(bad_insert).AtIndex("first_error"), suite.session, r.RunOpts{ |
| 157 | GeometryFormat: "raw", |
| 158 | GroupFormat: "map", |
| 159 | }) |
| 160 | suite.T().Log("Finished running line #42") |
| 161 | } |
| 162 | |
| 163 | { |
| 164 | // times/index.yaml line #46 |
| 165 | /* 5 */ |
| 166 | var expected_ int = 5 |
| 167 | /* table_test_times_index.between(ts, te).count() */ |
| 168 | |
| 169 | suite.T().Log("About to run line #46: table_test_times_index.Between(ts, te).Count()") |
| 170 | |
| 171 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(ts, te).Count(), suite.session, r.RunOpts{ |
| 172 | GeometryFormat: "raw", |
| 173 | GroupFormat: "map", |
| 174 | }) |
| 175 | suite.T().Log("Finished running line #46") |
| 176 | } |
| 177 | |
| 178 | { |
| 179 | // times/index.yaml line #48 |
| 180 | /* 3 */ |
| 181 | var expected_ int = 3 |
| 182 | /* table_test_times_index.between(t1, t4).count() */ |
| 183 | |
| 184 | suite.T().Log("About to run line #48: table_test_times_index.Between(t1, t4).Count()") |
| 185 | |
| 186 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, t4).Count(), suite.session, r.RunOpts{ |
| 187 | GeometryFormat: "raw", |
| 188 | GroupFormat: "map", |
| 189 | }) |
| 190 | suite.T().Log("Finished running line #48") |
| 191 | } |
| 192 | |
| 193 | { |
| 194 | // times/index.yaml line #51 |
| 195 | /* 4 */ |
| 196 | var expected_ int = 4 |
| 197 | /* table_test_times_index.between(t1, t4, right_bound='closed').count() */ |
| 198 | |
| 199 | suite.T().Log("About to run line #51: table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") |
| 200 | |
| 201 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ |
| 202 | GeometryFormat: "raw", |
| 203 | GroupFormat: "map", |
| 204 | }) |
| 205 | suite.T().Log("Finished running line #51") |
| 206 | } |
| 207 | |
| 208 | { |
| 209 | // times/index.yaml line #54 |
| 210 | /* 5 */ |
| 211 | var expected_ int = 5 |
| 212 | /* table_test_times_index.between(r.expr(ts).in_timezone("+06:00"), te).count() */ |
| 213 | |
| 214 | suite.T().Log("About to run line #54: table_test_times_index.Between(r.Expr(ts).InTimezone('+06:00'), te).Count()") |
| 215 | |
| 216 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(r.Expr(ts).InTimezone("+06:00"), te).Count(), suite.session, r.RunOpts{ |
| 217 | GeometryFormat: "raw", |
| 218 | GroupFormat: "map", |
| 219 | }) |
| 220 | suite.T().Log("Finished running line #54") |
| 221 | } |
| 222 | |
| 223 | { |
| 224 | // times/index.yaml line #56 |
| 225 | /* 3 */ |
| 226 | var expected_ int = 3 |
| 227 | /* table_test_times_index.between(t1, r.expr(t4).in_timezone("+08:00")).count() */ |
| 228 | |
| 229 | suite.T().Log("About to run line #56: table_test_times_index.Between(t1, r.Expr(t4).InTimezone('+08:00')).Count()") |
| 230 | |
| 231 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, r.Expr(t4).InTimezone("+08:00")).Count(), suite.session, r.RunOpts{ |
| 232 | GeometryFormat: "raw", |
| 233 | GroupFormat: "map", |
| 234 | }) |
| 235 | suite.T().Log("Finished running line #56") |
| 236 | } |
| 237 | |
| 238 | { |
| 239 | // times/index.yaml line #59 |
| 240 | /* 4 */ |
| 241 | var expected_ int = 4 |
| 242 | /* table_test_times_index.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed').count() */ |
| 243 | |
| 244 | suite.T().Log("About to run line #59: table_test_times_index.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") |
| 245 | |
| 246 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ |
| 247 | GeometryFormat: "raw", |
| 248 | GroupFormat: "map", |
| 249 | }) |
| 250 | suite.T().Log("Finished running line #59") |
| 251 | } |
| 252 | |
| 253 | { |
| 254 | // times/index.yaml line #64 |
| 255 | /* 5 */ |
| 256 | var expected_ int = 5 |
| 257 | /* table_test_times_index.update(lambda row:{'a':row['id']})['replaced'] */ |
| 258 | |
| 259 | suite.T().Log("About to run line #64: table_test_times_index.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id'), }}).AtIndex('replaced')") |
| 260 | |
| 261 | runAndAssert(suite.Suite, expected_, table_test_times_index.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id")} }).AtIndex("replaced"), suite.session, r.RunOpts{ |
| 262 | GeometryFormat: "raw", |
| 263 | GroupFormat: "map", |
| 264 | }) |
| 265 | suite.T().Log("Finished running line #64") |
| 266 | } |
| 267 | |
| 268 | { |
| 269 | // times/index.yaml line #67 |
| 270 | /* ({'created':1}) */ |
| 271 | var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} |
| 272 | /* table_test_times_index.index_create('a') */ |
| 273 | |
| 274 | suite.T().Log("About to run line #67: table_test_times_index.IndexCreate('a')") |
| 275 | |
| 276 | runAndAssert(suite.Suite, expected_, table_test_times_index.IndexCreate("a"), suite.session, r.RunOpts{ |
| 277 | GeometryFormat: "raw", |
| 278 | GroupFormat: "map", |
| 279 | }) |
| 280 | suite.T().Log("Finished running line #67") |
| 281 | } |
| 282 | |
| 283 | { |
| 284 | // times/index.yaml line #69 |
| 285 | /* 1 */ |
| 286 | var expected_ int = 1 |
| 287 | /* table_test_times_index.index_wait('a').count() */ |
| 288 | |
| 289 | suite.T().Log("About to run line #69: table_test_times_index.IndexWait('a').Count()") |
| 290 | |
| 291 | runAndAssert(suite.Suite, expected_, table_test_times_index.IndexWait("a").Count(), suite.session, r.RunOpts{ |
| 292 | GeometryFormat: "raw", |
| 293 | GroupFormat: "map", |
| 294 | }) |
| 295 | suite.T().Log("Finished running line #69") |
| 296 | } |
| 297 | |
| 298 | { |
| 299 | // times/index.yaml line #73 |
| 300 | /* 5 */ |
| 301 | var expected_ int = 5 |
| 302 | /* table_test_times_index.between(ts, te, index='a').count() */ |
| 303 | |
| 304 | suite.T().Log("About to run line #73: table_test_times_index.Between(ts, te).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") |
| 305 | |
| 306 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(ts, te).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ |
| 307 | GeometryFormat: "raw", |
| 308 | GroupFormat: "map", |
| 309 | }) |
| 310 | suite.T().Log("Finished running line #73") |
| 311 | } |
| 312 | |
| 313 | { |
| 314 | // times/index.yaml line #77 |
| 315 | /* 3 */ |
| 316 | var expected_ int = 3 |
| 317 | /* table_test_times_index.between(t1, t4, index='a').count() */ |
| 318 | |
| 319 | suite.T().Log("About to run line #77: table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") |
| 320 | |
| 321 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ |
| 322 | GeometryFormat: "raw", |
| 323 | GroupFormat: "map", |
| 324 | }) |
| 325 | suite.T().Log("Finished running line #77") |
| 326 | } |
| 327 | |
| 328 | { |
| 329 | // times/index.yaml line #81 |
| 330 | /* 4 */ |
| 331 | var expected_ int = 4 |
| 332 | /* table_test_times_index.between(t1, t4, right_bound='closed', index='a').count() */ |
| 333 | |
| 334 | suite.T().Log("About to run line #81: table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'a', }).Count()") |
| 335 | |
| 336 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "a"}).Count(), suite.session, r.RunOpts{ |
| 337 | GeometryFormat: "raw", |
| 338 | GroupFormat: "map", |
| 339 | }) |
| 340 | suite.T().Log("Finished running line #81") |
| 341 | } |
| 342 | |
| 343 | { |
| 344 | // times/index.yaml line #85 |
| 345 | /* 5 */ |
| 346 | var expected_ int = 5 |
| 347 | /* table_test_times_index.between(r.expr(ts).in_timezone("+06:00"), te, index='a').count() */ |
| 348 | |
| 349 | suite.T().Log("About to run line #85: table_test_times_index.Between(r.Expr(ts).InTimezone('+06:00'), te).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") |
| 350 | |
| 351 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(r.Expr(ts).InTimezone("+06:00"), te).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ |
| 352 | GeometryFormat: "raw", |
| 353 | GroupFormat: "map", |
| 354 | }) |
| 355 | suite.T().Log("Finished running line #85") |
| 356 | } |
| 357 | |
| 358 | { |
| 359 | // times/index.yaml line #89 |
| 360 | /* 3 */ |
| 361 | var expected_ int = 3 |
| 362 | /* table_test_times_index.between(t1, r.expr(t4).in_timezone("+08:00"), index='a').count() */ |
| 363 | |
| 364 | suite.T().Log("About to run line #89: table_test_times_index.Between(t1, r.Expr(t4).InTimezone('+08:00')).OptArgs(r.BetweenOpts{Index: 'a', }).Count()") |
| 365 | |
| 366 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, r.Expr(t4).InTimezone("+08:00")).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{ |
| 367 | GeometryFormat: "raw", |
| 368 | GroupFormat: "map", |
| 369 | }) |
| 370 | suite.T().Log("Finished running line #89") |
| 371 | } |
| 372 | |
| 373 | { |
| 374 | // times/index.yaml line #93 |
| 375 | /* 4 */ |
| 376 | var expected_ int = 4 |
| 377 | /* table_test_times_index.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed', index='a').count() */ |
| 378 | |
| 379 | suite.T().Log("About to run line #93: table_test_times_index.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'a', }).Count()") |
| 380 | |
| 381 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "a"}).Count(), suite.session, r.RunOpts{ |
| 382 | GeometryFormat: "raw", |
| 383 | GroupFormat: "map", |
| 384 | }) |
| 385 | suite.T().Log("Finished running line #93") |
| 386 | } |
| 387 | |
| 388 | { |
| 389 | // times/index.yaml line #98 |
| 390 | /* ({'created':1}) */ |
| 391 | var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} |
| 392 | /* table_test_times_index.index_create('b', lambda row:r.branch(row['id'] < t4, row['a'], null)) */ |
| 393 | |
| 394 | suite.T().Log("About to run line #98: table_test_times_index.IndexCreateFunc('b', func(row r.Term) interface{} { return r.Branch(row.AtIndex('id').Lt(t4), row.AtIndex('a'), nil)})") |
| 395 | |
| 396 | runAndAssert(suite.Suite, expected_, table_test_times_index.IndexCreateFunc("b", func(row r.Term) interface{} { return r.Branch(row.AtIndex("id").Lt(t4), row.AtIndex("a"), nil) }), suite.session, r.RunOpts{ |
| 397 | GeometryFormat: "raw", |
| 398 | GroupFormat: "map", |
| 399 | }) |
| 400 | suite.T().Log("Finished running line #98") |
| 401 | } |
| 402 | |
| 403 | { |
| 404 | // times/index.yaml line #101 |
| 405 | /* 1 */ |
| 406 | var expected_ int = 1 |
| 407 | /* table_test_times_index.index_wait('b').count() */ |
| 408 | |
| 409 | suite.T().Log("About to run line #101: table_test_times_index.IndexWait('b').Count()") |
| 410 | |
| 411 | runAndAssert(suite.Suite, expected_, table_test_times_index.IndexWait("b").Count(), suite.session, r.RunOpts{ |
| 412 | GeometryFormat: "raw", |
| 413 | GroupFormat: "map", |
| 414 | }) |
| 415 | suite.T().Log("Finished running line #101") |
| 416 | } |
| 417 | |
| 418 | { |
| 419 | // times/index.yaml line #105 |
| 420 | /* 1 */ |
| 421 | var expected_ int = 1 |
| 422 | /* table_test_times_index.index_wait('b').count() */ |
| 423 | |
| 424 | suite.T().Log("About to run line #105: table_test_times_index.IndexWait('b').Count()") |
| 425 | |
| 426 | runAndAssert(suite.Suite, expected_, table_test_times_index.IndexWait("b").Count(), suite.session, r.RunOpts{ |
| 427 | GeometryFormat: "raw", |
| 428 | GroupFormat: "map", |
| 429 | }) |
| 430 | suite.T().Log("Finished running line #105") |
| 431 | } |
| 432 | |
| 433 | { |
| 434 | // times/index.yaml line #109 |
| 435 | /* 3 */ |
| 436 | var expected_ int = 3 |
| 437 | /* table_test_times_index.between(ts, te, index='b').count() */ |
| 438 | |
| 439 | suite.T().Log("About to run line #109: table_test_times_index.Between(ts, te).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") |
| 440 | |
| 441 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(ts, te).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ |
| 442 | GeometryFormat: "raw", |
| 443 | GroupFormat: "map", |
| 444 | }) |
| 445 | suite.T().Log("Finished running line #109") |
| 446 | } |
| 447 | |
| 448 | { |
| 449 | // times/index.yaml line #113 |
| 450 | /* 3 */ |
| 451 | var expected_ int = 3 |
| 452 | /* table_test_times_index.between(t1, t4, index='b').count() */ |
| 453 | |
| 454 | suite.T().Log("About to run line #113: table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") |
| 455 | |
| 456 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ |
| 457 | GeometryFormat: "raw", |
| 458 | GroupFormat: "map", |
| 459 | }) |
| 460 | suite.T().Log("Finished running line #113") |
| 461 | } |
| 462 | |
| 463 | { |
| 464 | // times/index.yaml line #117 |
| 465 | /* 3 */ |
| 466 | var expected_ int = 3 |
| 467 | /* table_test_times_index.between(t1, t4, right_bound='closed', index='b').count() */ |
| 468 | |
| 469 | suite.T().Log("About to run line #117: table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'b', }).Count()") |
| 470 | |
| 471 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "b"}).Count(), suite.session, r.RunOpts{ |
| 472 | GeometryFormat: "raw", |
| 473 | GroupFormat: "map", |
| 474 | }) |
| 475 | suite.T().Log("Finished running line #117") |
| 476 | } |
| 477 | |
| 478 | { |
| 479 | // times/index.yaml line #121 |
| 480 | /* 3 */ |
| 481 | var expected_ int = 3 |
| 482 | /* table_test_times_index.between(r.expr(ts).in_timezone("+06:00"), te, index='b').count() */ |
| 483 | |
| 484 | suite.T().Log("About to run line #121: table_test_times_index.Between(r.Expr(ts).InTimezone('+06:00'), te).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") |
| 485 | |
| 486 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(r.Expr(ts).InTimezone("+06:00"), te).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ |
| 487 | GeometryFormat: "raw", |
| 488 | GroupFormat: "map", |
| 489 | }) |
| 490 | suite.T().Log("Finished running line #121") |
| 491 | } |
| 492 | |
| 493 | { |
| 494 | // times/index.yaml line #125 |
| 495 | /* 3 */ |
| 496 | var expected_ int = 3 |
| 497 | /* table_test_times_index.between(t1, r.expr(t4).in_timezone("+08:00"), index='b').count() */ |
| 498 | |
| 499 | suite.T().Log("About to run line #125: table_test_times_index.Between(t1, r.Expr(t4).InTimezone('+08:00')).OptArgs(r.BetweenOpts{Index: 'b', }).Count()") |
| 500 | |
| 501 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(t1, r.Expr(t4).InTimezone("+08:00")).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{ |
| 502 | GeometryFormat: "raw", |
| 503 | GroupFormat: "map", |
| 504 | }) |
| 505 | suite.T().Log("Finished running line #125") |
| 506 | } |
| 507 | |
| 508 | { |
| 509 | // times/index.yaml line #129 |
| 510 | /* 3 */ |
| 511 | var expected_ int = 3 |
| 512 | /* table_test_times_index.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed', index='b').count() */ |
| 513 | |
| 514 | suite.T().Log("About to run line #129: table_test_times_index.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'b', }).Count()") |
| 515 | |
| 516 | runAndAssert(suite.Suite, expected_, table_test_times_index.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "b"}).Count(), suite.session, r.RunOpts{ |
| 517 | GeometryFormat: "raw", |
| 518 | GroupFormat: "map", |
| 519 | }) |
| 520 | suite.T().Log("Finished running line #129") |
| 521 | } |
| 522 | |
| 523 | // times/index.yaml line #135 |
| 524 | // oldtime = datetime.fromtimestamp(1375147296.681, PacificTimeZone()) |
| 525 | suite.T().Log("Possibly executing: var oldtime time.Time = Ast.Fromtimestamp(1375147296.681, PacificTimeZone())") |
| 526 | |
| 527 | oldtime := Ast.Fromtimestamp(1375147296.681, PacificTimeZone()) |
| 528 | _ = oldtime // Prevent any noused variable errors |
| 529 | |
| 530 | // times/index.yaml line #139 |
| 531 | // curtime = datetime.now() |
| 532 | suite.T().Log("Possibly executing: var curtime time.Time = Ast.Now()") |
| 533 | |
| 534 | curtime := Ast.Now() |
| 535 | _ = curtime // Prevent any noused variable errors |
| 536 | |
| 537 | { |
| 538 | // times/index.yaml line #142 |
| 539 | /* 1 */ |
| 540 | var expected_ int = 1 |
| 541 | /* table_test_times_index.insert([{'id':oldtime}])['inserted'] */ |
| 542 | |
| 543 | suite.T().Log("About to run line #142: table_test_times_index.Insert([]interface{}{map[interface{}]interface{}{'id': oldtime, }}).AtIndex('inserted')") |
| 544 | |
| 545 | runAndAssert(suite.Suite, expected_, table_test_times_index.Insert([]interface{}{map[interface{}]interface{}{"id": oldtime}}).AtIndex("inserted"), suite.session, r.RunOpts{ |
| 546 | GeometryFormat: "raw", |
| 547 | GroupFormat: "map", |
| 548 | }) |
| 549 | suite.T().Log("Finished running line #142") |
| 550 | } |
| 551 | |
| 552 | { |
| 553 | // times/index.yaml line #148 |
| 554 | /* ("PTYPE<TIME>") */ |
| 555 | var expected_ string = "PTYPE<TIME>" |
| 556 | /* table_test_times_index.get(oldtime)['id'].type_of() */ |
| 557 | |
| 558 | suite.T().Log("About to run line #148: table_test_times_index.Get(oldtime).AtIndex('id').TypeOf()") |
| 559 | |
| 560 | runAndAssert(suite.Suite, expected_, table_test_times_index.Get(oldtime).AtIndex("id").TypeOf(), suite.session, r.RunOpts{ |
| 561 | GeometryFormat: "raw", |
| 562 | GroupFormat: "map", |
| 563 | }) |
| 564 | suite.T().Log("Finished running line #148") |
| 565 | } |
| 566 | } |