func (suite *TimesTimeArithSuite) TestCases() { suite.T().Log("Running TimesTimeArithSuite: Test basic time arithmetic") // times/time_arith.yaml line #3 // rt1 = 1375147296.681 suite.T().Log("Possibly executing: var rt1 float64 = 1375147296.681") rt1 := 1375147296.681 _ = rt1 // Prevent any noused variable errors // times/time_arith.yaml line #4 // rt2 = 1375147296.682 suite.T().Log("Possibly executing: var rt2 float64 = 1375147296.682") rt2 := 1375147296.682 _ = rt2 // Prevent any noused variable errors // times/time_arith.yaml line #5 // rt3 = 1375147297.681 suite.T().Log("Possibly executing: var rt3 float64 = 1375147297.681") rt3 := 1375147297.681 _ = rt3 // Prevent any noused variable errors // times/time_arith.yaml line #6 // rt4 = 2375147296.681 suite.T().Log("Possibly executing: var rt4 float64 = 2375147296.681") rt4 := 2375147296.681 _ = rt4 // Prevent any noused variable errors // times/time_arith.yaml line #7 // rts = [rt1, rt2, rt3, rt4] suite.T().Log("Possibly executing: var rts []interface{} = []interface{}{rt1, rt2, rt3, rt4}") rts := []interface{}{rt1, rt2, rt3, rt4} _ = rts // Prevent any noused variable errors // times/time_arith.yaml line #9 // t1 = r.epoch_time(rt1) suite.T().Log("Possibly executing: var t1 r.Term = r.EpochTime(rt1)") t1 := r.EpochTime(rt1) _ = t1 // Prevent any noused variable errors // times/time_arith.yaml line #10 // t2 = r.epoch_time(rt2) suite.T().Log("Possibly executing: var t2 r.Term = r.EpochTime(rt2)") t2 := r.EpochTime(rt2) _ = t2 // Prevent any noused variable errors // times/time_arith.yaml line #11 // t3 = r.epoch_time(rt3) suite.T().Log("Possibly executing: var t3 r.Term = r.EpochTime(rt3)") t3 := r.EpochTime(rt3) _ = t3 // Prevent any noused variable errors // times/time_arith.yaml line #12 // t4 = r.epoch_time(rt4) suite.T().Log("Possibly executing: var t4 r.Term = r.EpochTime(rt4)") t4 := r.EpochTime(rt4) _ = t4 // Prevent any noused variable errors // times/time_arith.yaml line #13 // ts = r.expr([t1, t2, t3, t4]) suite.T().Log("Possibly executing: var ts r.Term = r.Expr([]interface{}{t1, t2, t3, t4})") ts := r.Expr([]interface{}{t1, t2, t3, t4}) _ = ts // Prevent any noused variable errors { // times/time_arith.yaml line #17 /* true */ var expected_ bool = true /* ((t2 - t1) * 1000).do(lambda x:(x > 0.99) & (x < 1.01)) */ suite.T().Log("About to run line #17: r.Sub(t2, t1).Mul(1000).Do(func(x r.Term) interface{} { return r.Gt(x, 0.99).And(r.Lt(x, 1.01))})") runAndAssert(suite.Suite, expected_, r.Sub(t2, t1).Mul(1000).Do(func(x r.Term) interface{} { return r.Gt(x, 0.99).And(r.Lt(x, 1.01)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // times/time_arith.yaml line #20 /* 1 */ var expected_ int = 1 /* t3 - t1 */ suite.T().Log("About to run line #20: r.Sub(t3, t1)") runAndAssert(suite.Suite, expected_, r.Sub(t3, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // times/time_arith.yaml line #23 /* 1000000000 */ var expected_ int = 1000000000 /* t4 - t1 */ suite.T().Log("About to run line #23: r.Sub(t4, t1)") runAndAssert(suite.Suite, expected_, r.Sub(t4, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // times/time_arith.yaml line #28 /* true */ var expected_ bool = true /* ((t1 - t2) * 1000).do(lambda x:(x < -0.99) & (x > -1.01)) */ suite.T().Log("About to run line #28: r.Sub(t1, t2).Mul(1000).Do(func(x r.Term) interface{} { return r.Lt(x, -0.99).And(r.Gt(x, -1.01))})") runAndAssert(suite.Suite, expected_, r.Sub(t1, t2).Mul(1000).Do(func(x r.Term) interface{} { return r.Lt(x, -0.99).And(r.Gt(x, -1.01)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // times/time_arith.yaml line #31 /* -1 */ var expected_ int = -1 /* t1 - t3 */ suite.T().Log("About to run line #31: r.Sub(t1, t3)") runAndAssert(suite.Suite, expected_, r.Sub(t1, t3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // times/time_arith.yaml line #34 /* -1000000000 */ var expected_ int = -1000000000 /* t1 - t4 */ suite.T().Log("About to run line #34: r.Sub(t1, t4)") runAndAssert(suite.Suite, expected_, r.Sub(t1, t4), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // times/time_arith.yaml line #39 /* ([rt1, rt2, rt3, rt4]) */ var expected_ []interface{} = []interface{}{rt1, rt2, rt3, rt4} /* ts.map(lambda x:t1 + (x - t1)).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #39: ts.Map(func(x r.Term) interface{} { return r.Add(t1, r.Sub(x, t1))}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Add(t1, r.Sub(x, t1)) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // times/time_arith.yaml line #43 /* err("ReqlQueryLogicError", "Expected type NUMBER but found PTYPE<TIME>.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found PTYPE<TIME>.") /* ts.map(lambda x:(t1 + x) - t1).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #43: ts.Map(func(x r.Term) interface{} { return r.Add(t1, x).Sub(t1)}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Add(t1, x).Sub(t1) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // times/time_arith.yaml line #47 /* ([rt1, rt2, rt3, rt4]) */ var expected_ []interface{} = []interface{}{rt1, rt2, rt3, rt4} /* ts.map(lambda x:t1 - (t1 - x)).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #47: ts.Map(func(x r.Term) interface{} { return r.Sub(t1, r.Sub(t1, x))}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Sub(t1, r.Sub(t1, x)) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // times/time_arith.yaml line #52 /* ([[[false, true, true, false, true, false], [true, true, false, true, false, false], [true, true, false, true, false, false], [true, true, false, true, false, false]], [[false, false, false, true, true, true], [false, true, true, false, true, false], [true, true, false, true, false, false], [true, true, false, true, false, false]], [[false, false, false, true, true, true], [false, false, false, true, true, true], [false, true, true, false, true, false], [true, true, false, true, false, false]], [[false, false, false, true, true, true], [false, false, false, true, true, true], [false, false, false, true, true, true], [false, true, true, false, true, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, true, true, false, true, false}, []interface{}{true, true, false, true, false, false}, []interface{}{true, true, false, true, false, false}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{false, true, true, false, true, false}, []interface{}{true, true, false, true, false, false}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{false, false, false, true, true, true}, []interface{}{false, true, true, false, true, false}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{false, false, false, true, true, true}, []interface{}{false, false, false, true, true, true}, []interface{}{false, true, true, false, true, false}}} /* ts.map(lambda x:ts.map(lambda y:[x < y, x <= y, x == y, x != y, x >= y, x > y])) */ suite.T().Log("About to run line #52: ts.Map(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return []interface{}{r.Lt(x, y), r.Le(x, y), r.Eq(x, y), r.Ne(x, y), r.Ge(x, y), r.Gt(x, y)}})})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return []interface{}{r.Lt(x, y), r.Le(x, y), r.Eq(x, y), r.Ne(x, y), r.Ge(x, y), r.Gt(x, y)} }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } // times/time_arith.yaml line #73 // datum_types = r.expr([null, true, false, 1, "1", [1], {"1":1}, r.binary(b'')]) suite.T().Log("Possibly executing: var datum_types r.Term = r.Expr([]interface{}{nil, true, false, 1, '1', []interface{}{1}, map[interface{}]interface{}{'1': 1, }, r.Binary([]byte{})})") datum_types := r.Expr([]interface{}{nil, true, false, 1, "1", []interface{}{1}, map[interface{}]interface{}{"1": 1}, r.Binary([]byte{})}) _ = datum_types // Prevent any noused variable errors { // times/time_arith.yaml line #79 /* ([[[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[false, false, false, true, true, true], [true, true, false, true, false, false]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]], [[true, true, false, true, false, false], [false, false, false, true, true, true]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{false, false, false, true, true, true}, []interface{}{true, true, false, true, false, false}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}, []interface{}{[]interface{}{true, true, false, true, false, false}, []interface{}{false, false, false, true, true, true}}} /* datum_types.map(lambda x:r.expr([[x, t1], [t1, x]]).map(lambda xy:xy[0].do(lambda x2:xy[1].do(lambda y:[x2 < y, x2 <= y, x2 == y, x2 != y, x2 >= y, x2 > y])))) */ suite.T().Log("About to run line #79: datum_types.Map(func(x r.Term) interface{} { return r.Expr([]interface{}{[]interface{}{x, t1}, []interface{}{t1, x}}).Map(func(xy r.Term) interface{} { return xy.AtIndex(0).Do(func(x2 r.Term) interface{} { return xy.AtIndex(1).Do(func(y r.Term) interface{} { return []interface{}{r.Lt(x2, y), r.Le(x2, y), r.Eq(x2, y), r.Ne(x2, y), r.Ge(x2, y), r.Gt(x2, y)}})})})})") runAndAssert(suite.Suite, expected_, datum_types.Map(func(x r.Term) interface{} { return r.Expr([]interface{}{[]interface{}{x, t1}, []interface{}{t1, x}}).Map(func(xy r.Term) interface{} { return xy.AtIndex(0).Do(func(x2 r.Term) interface{} { return xy.AtIndex(1).Do(func(y r.Term) interface{} { return []interface{}{r.Lt(x2, y), r.Le(x2, y), r.Eq(x2, y), r.Ne(x2, y), r.Ge(x2, y), r.Gt(x2, y)} }) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #79") } { // times/time_arith.yaml line #99 /* ([[[false, true, true, true], [false, false, true, true], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, true, true], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c)))) */ suite.T().Log("About to run line #99: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c)})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // times/time_arith.yaml line #119 /* ([[[false, false, false, false], [false, false, true, true], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, true], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c, left_bound='open')))) */ suite.T().Log("About to run line #119: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: 'open', })})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: "open"}) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #119") } { // times/time_arith.yaml line #139 /* ([[[true, true, true, true], [false, true, true, true], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, true, true, true], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, true]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{true, true, true, true}, []interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c, right_bound='closed')))) */ suite.T().Log("About to run line #139: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{RightBound: 'closed', })})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{RightBound: "closed"}) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #139") } { // times/time_arith.yaml line #159 /* ([[[false, false, false, false], [false, true, true, true], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, true, true], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, true]], [[false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false]]]) */ var expected_ []interface{} = []interface{}{[]interface{}{[]interface{}{false, false, false, false}, []interface{}{false, true, true, true}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, true, true}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, true}}, []interface{}{[]interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}, []interface{}{false, false, false, false}}} /* ts.map(lambda a:ts.map(lambda b:ts.map(lambda c:b.during(a, c, left_bound='open', right_bound='closed')))) */ suite.T().Log("About to run line #159: ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: 'open', RightBound: 'closed', })})})})") runAndAssert(suite.Suite, expected_, ts.Map(func(a r.Term) interface{} { return ts.Map(func(b r.Term) interface{} { return ts.Map(func(c r.Term) interface{} { return b.During(a, c).OptArgs(r.DuringOpts{LeftBound: "open", RightBound: "closed"}) }) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // times/time_arith.yaml line #179 /* rts */ var expected_ []interface{} = rts /* ts.map(lambda x:x.date() + x.time_of_day()).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #179: ts.Map(func(x r.Term) interface{} { return x.Date().Add(x.TimeOfDay())}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return x.Date().Add(x.TimeOfDay()) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #179") } { // times/time_arith.yaml line #185 /* rt1 */ var expected_ float64 = rt1 /* r.epoch_time(rt1).do(r.js("(function(data){return data})")).to_epoch_time() */ suite.T().Log("About to run line #185: r.EpochTime(rt1).Do(r.JS('(function(data){return data})')).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.EpochTime(rt1).Do(r.JS("(function(data){return data})")).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #185") } { // times/time_arith.yaml line #190 /* ("2012-08-01T00:00:00+00:00") */ var expected_ string = "2012-08-01T00:00:00+00:00" /* r.do(r.js("new Date('2012-08-01')")).to_iso8601() */ suite.T().Log("About to run line #190: r.Do(r.JS('new Date('2012-08-01')')).ToISO8601()") runAndAssert(suite.Suite, expected_, r.Do(r.JS("new Date('2012-08-01')")).ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #190") } { // times/time_arith.yaml line #195 /* ("2012-08-01T00:00:00+00:00") */ var expected_ string = "2012-08-01T00:00:00+00:00" /* r.do(r.js("(function(x){doc = new Object(); doc.date = new Date('2012-08-01'); return doc;})"))["date"].to_iso8601() */ suite.T().Log("About to run line #195: r.Do(r.JS('(function(x){doc = new Object(); doc.date = new Date('2012-08-01'); return doc;})')).AtIndex('date').ToISO8601()") runAndAssert(suite.Suite, expected_, r.Do(r.JS("(function(x){doc = new Object(); doc.date = new Date('2012-08-01'); return doc;})")).AtIndex("date").ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #195") } }
func (suite *TimesTimezonesSuite) TestCases() { suite.T().Log("Running TimesTimezonesSuite: Test basic timezone manipulation") // times/timezones.yaml line #3 // t1 = r.time(2013, r.july, 29, 23, 30, 0, "+00:00") suite.T().Log("Possibly executing: var t1 r.Term = r.Time(2013, r.July, 29, 23, 30, 0, '+00:00')") t1 := r.Time(2013, r.July, 29, 23, 30, 0, "+00:00") _ = t1 // Prevent any noused variable errors // times/timezones.yaml line #5 // tutc1 = t1.in_timezone("Z") suite.T().Log("Possibly executing: var tutc1 r.Term = t1.InTimezone('Z')") tutc1 := t1.InTimezone("Z") _ = tutc1 // Prevent any noused variable errors // times/timezones.yaml line #6 // tutc2 = t1.in_timezone("+00:00") suite.T().Log("Possibly executing: var tutc2 r.Term = t1.InTimezone('+00:00')") tutc2 := t1.InTimezone("+00:00") _ = tutc2 // Prevent any noused variable errors // times/timezones.yaml line #7 // tutc3 = t1.in_timezone("+00") suite.T().Log("Possibly executing: var tutc3 r.Term = t1.InTimezone('+00')") tutc3 := t1.InTimezone("+00") _ = tutc3 // Prevent any noused variable errors // times/timezones.yaml line #8 // tutcs = r.expr([tutc1, tutc2, tutc3]) suite.T().Log("Possibly executing: var tutcs r.Term = r.Expr([]interface{}{tutc1, tutc2, tutc3})") tutcs := r.Expr([]interface{}{tutc1, tutc2, tutc3}) _ = tutcs // Prevent any noused variable errors // times/timezones.yaml line #10 // tm1 = t1.in_timezone("-00:59") suite.T().Log("Possibly executing: var tm1 r.Term = t1.InTimezone('-00:59')") tm1 := t1.InTimezone("-00:59") _ = tm1 // Prevent any noused variable errors // times/timezones.yaml line #11 // tm2 = t1.in_timezone("-01:00") suite.T().Log("Possibly executing: var tm2 r.Term = t1.InTimezone('-01:00')") tm2 := t1.InTimezone("-01:00") _ = tm2 // Prevent any noused variable errors // times/timezones.yaml line #12 // tm3 = t1.in_timezone("-01:01") suite.T().Log("Possibly executing: var tm3 r.Term = t1.InTimezone('-01:01')") tm3 := t1.InTimezone("-01:01") _ = tm3 // Prevent any noused variable errors // times/timezones.yaml line #13 // tms = r.expr([tm1, tm2, tm3]) suite.T().Log("Possibly executing: var tms r.Term = r.Expr([]interface{}{tm1, tm2, tm3})") tms := r.Expr([]interface{}{tm1, tm2, tm3}) _ = tms // Prevent any noused variable errors // times/timezones.yaml line #15 // tp1 = t1.in_timezone("+00:59") suite.T().Log("Possibly executing: var tp1 r.Term = t1.InTimezone('+00:59')") tp1 := t1.InTimezone("+00:59") _ = tp1 // Prevent any noused variable errors // times/timezones.yaml line #16 // tp2 = t1.in_timezone("+01:00") suite.T().Log("Possibly executing: var tp2 r.Term = t1.InTimezone('+01:00')") tp2 := t1.InTimezone("+01:00") _ = tp2 // Prevent any noused variable errors // times/timezones.yaml line #17 // tp3 = t1.in_timezone("+01:01") suite.T().Log("Possibly executing: var tp3 r.Term = t1.InTimezone('+01:01')") tp3 := t1.InTimezone("+01:01") _ = tp3 // Prevent any noused variable errors // times/timezones.yaml line #18 // tps = r.expr([tp1, tp2, tp3]) suite.T().Log("Possibly executing: var tps r.Term = r.Expr([]interface{}{tp1, tp2, tp3})") tps := r.Expr([]interface{}{tp1, tp2, tp3}) _ = tps // Prevent any noused variable errors // times/timezones.yaml line #20 // ts = tutcs.union(tms).union(tps).union([t1]) suite.T().Log("Possibly executing: var ts r.Term = tutcs.Union(tms).Union(tps).Union([]interface{}{t1})") ts := tutcs.Union(tms).Union(tps).Union([]interface{}{t1}) _ = ts // Prevent any noused variable errors { // times/timezones.yaml line #23 /* ([["+00:00", 29], ["+00:00", 29], ["+00:00", 29]]) */ var expected_ []interface{} = []interface{}{[]interface{}{"+00:00", 29}, []interface{}{"+00:00", 29}, []interface{}{"+00:00", 29}} /* tutcs.map(lambda x:[x.timezone(), x.day()]) */ suite.T().Log("About to run line #23: tutcs.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()}})") runAndAssert(suite.Suite, expected_, tutcs.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // times/timezones.yaml line #27 /* ([["-00:59", 29], ["-01:00", 29], ["-01:01", 29]]) */ var expected_ []interface{} = []interface{}{[]interface{}{"-00:59", 29}, []interface{}{"-01:00", 29}, []interface{}{"-01:01", 29}} /* tms.map(lambda x:[x.timezone(), x.day()]) */ suite.T().Log("About to run line #27: tms.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()}})") runAndAssert(suite.Suite, expected_, tms.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // times/timezones.yaml line #31 /* ([["+00:59", 30], ["+01:00", 30], ["+01:01", 30]]) */ var expected_ []interface{} = []interface{}{[]interface{}{"+00:59", 30}, []interface{}{"+01:00", 30}, []interface{}{"+01:01", 30}} /* tps.map(lambda x:[x.timezone(), x.day()]) */ suite.T().Log("About to run line #31: tps.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()}})") runAndAssert(suite.Suite, expected_, tps.Map(func(x r.Term) interface{} { return []interface{}{x.Timezone(), x.Day()} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // times/timezones.yaml line #38 /* ([0]) */ var expected_ []interface{} = []interface{}{0} /* ts.concat_map(lambda x:ts.map(lambda y:x - y)).distinct() */ suite.T().Log("About to run line #38: ts.ConcatMap(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return r.Sub(x, y)})}).Distinct()") runAndAssert(suite.Suite, expected_, ts.ConcatMap(func(x r.Term) interface{} { return ts.Map(func(y r.Term) interface{} { return r.Sub(x, y) }) }).Distinct(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // times/timezones.yaml line #44 /* err('ReqlQueryLogicError', 'Timezone `` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `` does not start with `-` or `+`.") /* r.now().in_timezone("") */ suite.T().Log("About to run line #44: r.Now().InTimezone('')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone(""), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // times/timezones.yaml line #47 /* err('ReqlQueryLogicError', '`-00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00` is not a valid time offset.") /* r.now().in_timezone("-00") */ suite.T().Log("About to run line #47: r.Now().InTimezone('-00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("-00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // times/timezones.yaml line #50 /* err('ReqlQueryLogicError', '`-00:00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00:00` is not a valid time offset.") /* r.now().in_timezone("-00:00") */ suite.T().Log("About to run line #50: r.Now().InTimezone('-00:00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("-00:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // times/timezones.yaml line #53 /* err('ReqlQueryLogicError', 'Timezone `UTC+00` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `UTC+00` does not start with `-` or `+`.") /* r.now().in_timezone("UTC+00") */ suite.T().Log("About to run line #53: r.Now().InTimezone('UTC+00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("UTC+00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // times/timezones.yaml line #56 /* err('ReqlQueryLogicError', 'Minutes out of range in `+00:60`.') */ var expected_ Err = err("ReqlQueryLogicError", "Minutes out of range in `+00:60`.") /* r.now().in_timezone("+00:60") */ suite.T().Log("About to run line #56: r.Now().InTimezone('+00:60')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("+00:60"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #56") } { // times/timezones.yaml line #59 /* err('ReqlQueryLogicError', 'Hours out of range in `+25:00`.') */ var expected_ Err = err("ReqlQueryLogicError", "Hours out of range in `+25:00`.") /* r.now().in_timezone("+25:00") */ suite.T().Log("About to run line #59: r.Now().InTimezone('+25:00')") runAndAssert(suite.Suite, expected_, r.Now().InTimezone("+25:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // times/timezones.yaml line #63 /* err('ReqlQueryLogicError', 'Timezone `` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `` does not start with `-` or `+`.") /* r.time(2013, 1, 1, "") */ suite.T().Log("About to run line #63: r.Time(2013, 1, 1, '')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, ""), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // times/timezones.yaml line #66 /* err('ReqlQueryLogicError', '`-00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00` is not a valid time offset.") /* r.time(2013, 1, 1, "-00") */ suite.T().Log("About to run line #66: r.Time(2013, 1, 1, '-00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "-00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // times/timezones.yaml line #69 /* err('ReqlQueryLogicError', '`-00:00` is not a valid time offset.') */ var expected_ Err = err("ReqlQueryLogicError", "`-00:00` is not a valid time offset.") /* r.time(2013, 1, 1, "-00:00") */ suite.T().Log("About to run line #69: r.Time(2013, 1, 1, '-00:00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "-00:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } { // times/timezones.yaml line #72 /* err('ReqlQueryLogicError', 'Timezone `UTC+00` does not start with `-` or `+`.') */ var expected_ Err = err("ReqlQueryLogicError", "Timezone `UTC+00` does not start with `-` or `+`.") /* r.time(2013, 1, 1, "UTC+00") */ suite.T().Log("About to run line #72: r.Time(2013, 1, 1, 'UTC+00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "UTC+00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #72") } { // times/timezones.yaml line #75 /* err('ReqlQueryLogicError', 'Minutes out of range in `+00:60`.') */ var expected_ Err = err("ReqlQueryLogicError", "Minutes out of range in `+00:60`.") /* r.time(2013, 1, 1, "+00:60") */ suite.T().Log("About to run line #75: r.Time(2013, 1, 1, '+00:60')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "+00:60"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #75") } { // times/timezones.yaml line #78 /* err('ReqlQueryLogicError', 'Hours out of range in `+25:00`.') */ var expected_ Err = err("ReqlQueryLogicError", "Hours out of range in `+25:00`.") /* r.time(2013, 1, 1, "+25:00") */ suite.T().Log("About to run line #78: r.Time(2013, 1, 1, '+25:00')") runAndAssert(suite.Suite, expected_, r.Time(2013, 1, 1, "+25:00"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // times/timezones.yaml line #81 /* ("2015-07-08T00:00:00-08:00") */ var expected_ string = "2015-07-08T00:00:00-08:00" /* r.epoch_time(1436428422.339).in_timezone('-08:00').date().to_iso8601() */ suite.T().Log("About to run line #81: r.EpochTime(1436428422.339).InTimezone('-08:00').Date().ToISO8601()") runAndAssert(suite.Suite, expected_, r.EpochTime(1436428422.339).InTimezone("-08:00").Date().ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // times/timezones.yaml line #85 /* ("2015-07-09T00:00:00-07:00") */ var expected_ string = "2015-07-09T00:00:00-07:00" /* r.epoch_time(1436428422.339).in_timezone('-07:00').date().to_iso8601() */ suite.T().Log("About to run line #85: r.EpochTime(1436428422.339).InTimezone('-07:00').Date().ToISO8601()") runAndAssert(suite.Suite, expected_, r.EpochTime(1436428422.339).InTimezone("-07:00").Date().ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } }
func (suite *TimesApiSuite) TestCases() { suite.T().Log("Running TimesApiSuite: date/time api (#977)") // times/api.yaml line #6 // rt1 = 1375147296.6812 suite.T().Log("Possibly executing: var rt1 float64 = 1375147296.6812") rt1 := 1375147296.6812 _ = rt1 // Prevent any noused variable errors // times/api.yaml line #7 // t1 = r.epoch_time(rt1) suite.T().Log("Possibly executing: var t1 r.Term = r.EpochTime(rt1)") t1 := r.EpochTime(rt1) _ = t1 // Prevent any noused variable errors // times/api.yaml line #8 // t2 = r.epoch_time(rt1 + 1000) suite.T().Log("Possibly executing: var t2 r.Term = r.EpochTime(r.Add(rt1, 1000))") t2 := r.EpochTime(r.Add(rt1, 1000)) _ = t2 // Prevent any noused variable errors { // times/api.yaml line #11 /* (1375148296.681) */ var expected_ float64 = 1375148296.681 /* (t1 + 1000).to_epoch_time() */ suite.T().Log("About to run line #11: r.Add(t1, 1000).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Add(t1, 1000).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // times/api.yaml line #14 /* (1375146296.681) */ var expected_ float64 = 1375146296.681 /* (t1 - 1000).to_epoch_time() */ suite.T().Log("About to run line #14: r.Sub(t1, 1000).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Sub(t1, 1000).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // times/api.yaml line #17 /* 1000 */ var expected_ int = 1000 /* (t1 - (t1 - 1000)) */ suite.T().Log("About to run line #17: r.Sub(t1, r.Sub(t1, 1000))") runAndAssert(suite.Suite, expected_, r.Sub(t1, r.Sub(t1, 1000)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // times/api.yaml line #22 /* false */ var expected_ bool = false /* (t1 < t1) */ suite.T().Log("About to run line #22: r.Lt(t1, t1)") runAndAssert(suite.Suite, expected_, r.Lt(t1, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // times/api.yaml line #25 /* true */ var expected_ bool = true /* (t1 <= t1) */ suite.T().Log("About to run line #25: r.Le(t1, t1)") runAndAssert(suite.Suite, expected_, r.Le(t1, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // times/api.yaml line #29 /* true */ var expected_ bool = true /* (t1 == t1) */ suite.T().Log("About to run line #29: r.Eq(t1, t1)") runAndAssert(suite.Suite, expected_, r.Eq(t1, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // times/api.yaml line #32 /* false */ var expected_ bool = false /* (t1 != t1) */ suite.T().Log("About to run line #32: r.Ne(t1, t1)") runAndAssert(suite.Suite, expected_, r.Ne(t1, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #32") } { // times/api.yaml line #34 /* true */ var expected_ bool = true /* (t1 >= t1) */ suite.T().Log("About to run line #34: r.Ge(t1, t1)") runAndAssert(suite.Suite, expected_, r.Ge(t1, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // times/api.yaml line #37 /* false */ var expected_ bool = false /* (t1 > t1) */ suite.T().Log("About to run line #37: r.Gt(t1, t1)") runAndAssert(suite.Suite, expected_, r.Gt(t1, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // times/api.yaml line #40 /* true */ var expected_ bool = true /* (t1 < t2) */ suite.T().Log("About to run line #40: r.Lt(t1, t2)") runAndAssert(suite.Suite, expected_, r.Lt(t1, t2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // times/api.yaml line #43 /* true */ var expected_ bool = true /* (t1 <= t2) */ suite.T().Log("About to run line #43: r.Le(t1, t2)") runAndAssert(suite.Suite, expected_, r.Le(t1, t2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // times/api.yaml line #47 /* false */ var expected_ bool = false /* (t1 == t2) */ suite.T().Log("About to run line #47: r.Eq(t1, t2)") runAndAssert(suite.Suite, expected_, r.Eq(t1, t2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // times/api.yaml line #50 /* true */ var expected_ bool = true /* (t1 != t2) */ suite.T().Log("About to run line #50: r.Ne(t1, t2)") runAndAssert(suite.Suite, expected_, r.Ne(t1, t2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // times/api.yaml line #52 /* false */ var expected_ bool = false /* (t1 >= t2) */ suite.T().Log("About to run line #52: r.Ge(t1, t2)") runAndAssert(suite.Suite, expected_, r.Ge(t1, t2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // times/api.yaml line #55 /* false */ var expected_ bool = false /* (t1 > t2) */ suite.T().Log("About to run line #55: r.Gt(t1, t2)") runAndAssert(suite.Suite, expected_, r.Gt(t1, t2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // times/api.yaml line #60 /* true */ var expected_ bool = true /* t1.during(t1, t1 + 1000) */ suite.T().Log("About to run line #60: t1.During(t1, r.Add(t1, 1000))") runAndAssert(suite.Suite, expected_, t1.During(t1, r.Add(t1, 1000)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // times/api.yaml line #64 /* false */ var expected_ bool = false /* t1.during(t1, t1 + 1000, left_bound='open') */ suite.T().Log("About to run line #64: t1.During(t1, r.Add(t1, 1000)).OptArgs(r.DuringOpts{LeftBound: 'open', })") runAndAssert(suite.Suite, expected_, t1.During(t1, r.Add(t1, 1000)).OptArgs(r.DuringOpts{LeftBound: "open"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #64") } { // times/api.yaml line #67 /* false */ var expected_ bool = false /* t1.during(t1, t1) */ suite.T().Log("About to run line #67: t1.During(t1, t1)") runAndAssert(suite.Suite, expected_, t1.During(t1, t1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #67") } { // times/api.yaml line #70 /* true */ var expected_ bool = true /* t1.during(t1, t1, right_bound='closed') */ suite.T().Log("About to run line #70: t1.During(t1, t1).OptArgs(r.DuringOpts{RightBound: 'closed', })") runAndAssert(suite.Suite, expected_, t1.During(t1, t1).OptArgs(r.DuringOpts{RightBound: "closed"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // times/api.yaml line #77 /* 1375142400 */ var expected_ int = 1375142400 /* t1.date().to_epoch_time() */ suite.T().Log("About to run line #77: t1.Date().ToEpochTime()") runAndAssert(suite.Suite, expected_, t1.Date().ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #77") } { // times/api.yaml line #79 /* (4896.681) */ var expected_ float64 = 4896.681 /* t1.time_of_day() */ suite.T().Log("About to run line #79: t1.TimeOfDay()") runAndAssert(suite.Suite, expected_, t1.TimeOfDay(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #79") } { // times/api.yaml line #81 /* 2013 */ var expected_ int = 2013 /* t1.year() */ suite.T().Log("About to run line #81: t1.Year()") runAndAssert(suite.Suite, expected_, t1.Year(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // times/api.yaml line #83 /* 7 */ var expected_ int = 7 /* t1.month() */ suite.T().Log("About to run line #83: t1.Month()") runAndAssert(suite.Suite, expected_, t1.Month(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } { // times/api.yaml line #85 /* 30 */ var expected_ int = 30 /* t1.day() */ suite.T().Log("About to run line #85: t1.Day()") runAndAssert(suite.Suite, expected_, t1.Day(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } { // times/api.yaml line #87 /* 2 */ var expected_ int = 2 /* t1.day_of_week() */ suite.T().Log("About to run line #87: t1.DayOfWeek()") runAndAssert(suite.Suite, expected_, t1.DayOfWeek(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #87") } { // times/api.yaml line #89 /* 211 */ var expected_ int = 211 /* t1.day_of_year() */ suite.T().Log("About to run line #89: t1.DayOfYear()") runAndAssert(suite.Suite, expected_, t1.DayOfYear(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // times/api.yaml line #91 /* 1 */ var expected_ int = 1 /* t1.hours() */ suite.T().Log("About to run line #91: t1.Hours()") runAndAssert(suite.Suite, expected_, t1.Hours(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #91") } { // times/api.yaml line #93 /* 21 */ var expected_ int = 21 /* t1.minutes() */ suite.T().Log("About to run line #93: t1.Minutes()") runAndAssert(suite.Suite, expected_, t1.Minutes(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } { // times/api.yaml line #95 /* 36.681 */ var expected_ float64 = 36.681 /* t1.seconds() */ suite.T().Log("About to run line #95: t1.Seconds()") runAndAssert(suite.Suite, expected_, t1.Seconds(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // times/api.yaml line #99 /* (1375165800.1) */ var expected_ float64 = 1375165800.1 /* r.time(2013, r.july, 29, 23, 30, 0.1, "-07:00").to_epoch_time() */ suite.T().Log("About to run line #99: r.Time(2013, r.July, 29, 23, 30, 0.1, '-07:00').ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, 23, 30, 0.1, "-07:00").ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // times/api.yaml line #101 /* ("-07:00") */ var expected_ string = "-07:00" /* r.time(2013, r.july, 29, 23, 30, 0.1, "-07:00").timezone() */ suite.T().Log("About to run line #101: r.Time(2013, r.July, 29, 23, 30, 0.1, '-07:00').Timezone()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, 23, 30, 0.1, "-07:00").Timezone(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // times/api.yaml line #103 /* err("ReqlQueryLogicError", "Got 6 arguments to TIME (expected 4 or 7).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Got 6 arguments to TIME (expected 4 or 7).") /* r.time(2013, r.july, 29, 23, 30, 0.1).to_epoch_time() */ suite.T().Log("About to run line #103: r.Time(2013, r.July, 29, 23, 30, 0.1).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, 23, 30, 0.1).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // times/api.yaml line #105 /* err("ReqlQueryLogicError", "Got 6 arguments to TIME (expected 4 or 7).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Got 6 arguments to TIME (expected 4 or 7).") /* r.time(2013, r.july, 29, 23, 30, 0.1).timezone() */ suite.T().Log("About to run line #105: r.Time(2013, r.July, 29, 23, 30, 0.1).Timezone()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, 23, 30, 0.1).Timezone(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // times/api.yaml line #107 /* err("ReqlQueryLogicError", "Got 5 arguments to TIME (expected 4 or 7).", []) */ var expected_ Err = err("ReqlQueryLogicError", "Got 5 arguments to TIME (expected 4 or 7).") /* r.time(2013, r.july, 29, 23, 30).to_epoch_time() */ suite.T().Log("About to run line #107: r.Time(2013, r.July, 29, 23, 30).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, 23, 30).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #107") } { // times/api.yaml line #109 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* r.time(2013, r.july, 29, 23).to_epoch_time() */ suite.T().Log("About to run line #109: r.Time(2013, r.July, 29, 23).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, 23).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } { // times/api.yaml line #111 /* 1375081200 */ var expected_ int = 1375081200 /* r.time(2013, r.july, 29, "-07:00").to_epoch_time() */ suite.T().Log("About to run line #111: r.Time(2013, r.July, 29, '-07:00').ToEpochTime()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, "-07:00").ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } { // times/api.yaml line #113 /* ("-07:00") */ var expected_ string = "-07:00" /* r.time(2013, r.july, 29, "-07:00").timezone() */ suite.T().Log("About to run line #113: r.Time(2013, r.July, 29, '-07:00').Timezone()") runAndAssert(suite.Suite, expected_, r.Time(2013, r.July, 29, "-07:00").Timezone(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // times/api.yaml line #119 /* 1375242965 */ var expected_ int = 1375242965 /* r.iso8601("2013-07-30T20:56:05-07:00").to_epoch_time() */ suite.T().Log("About to run line #119: r.ISO8601('2013-07-30T20:56:05-07:00').ToEpochTime()") runAndAssert(suite.Suite, expected_, r.ISO8601("2013-07-30T20:56:05-07:00").ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #119") } { // times/api.yaml line #122 /* ("2013-07-30T20:56:05-07:00") */ var expected_ string = "2013-07-30T20:56:05-07:00" /* r.epoch_time(1375242965).in_timezone("-07:00").to_iso8601() */ suite.T().Log("About to run line #122: r.EpochTime(1375242965).InTimezone('-07:00').ToISO8601()") runAndAssert(suite.Suite, expected_, r.EpochTime(1375242965).InTimezone("-07:00").ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // times/api.yaml line #125 /* ("PTYPE<TIME>") */ var expected_ string = "PTYPE<TIME>" /* r.now().type_of() */ suite.T().Log("About to run line #125: r.Now().TypeOf()") runAndAssert(suite.Suite, expected_, r.Now().TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // times/api.yaml line #127 /* 0 */ var expected_ int = 0 /* (r.now() - r.now()) */ suite.T().Log("About to run line #127: r.Now().Sub(r.Now())") runAndAssert(suite.Suite, expected_, r.Now().Sub(r.Now()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #127") } { // times/api.yaml line #132 /* err("ReqlQueryLogicError", "ISO 8601 string has no time zone, and no default time zone was provided.", []) */ var expected_ Err = err("ReqlQueryLogicError", "ISO 8601 string has no time zone, and no default time zone was provided.") /* r.iso8601("2013-07-30T20:56:05").to_iso8601() */ suite.T().Log("About to run line #132: r.ISO8601('2013-07-30T20:56:05').ToISO8601()") runAndAssert(suite.Suite, expected_, r.ISO8601("2013-07-30T20:56:05").ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } { // times/api.yaml line #136 /* ("2013-07-30T20:56:05-07:00") */ var expected_ string = "2013-07-30T20:56:05-07:00" /* r.iso8601("2013-07-30T20:56:05", default_timezone='-07').to_iso8601() */ suite.T().Log("About to run line #136: r.ISO8601('2013-07-30T20:56:05').OptArgs(r.ISO8601Opts{DefaultTimezone: '-07', }).ToISO8601()") runAndAssert(suite.Suite, expected_, r.ISO8601("2013-07-30T20:56:05").OptArgs(r.ISO8601Opts{DefaultTimezone: "-07"}).ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #136") } { // times/api.yaml line #140 /* ([1, 2, 3, 4, 5, 6, 7]) */ var expected_ []interface{} = []interface{}{1, 2, 3, 4, 5, 6, 7} /* r.expr([r.monday, r.tuesday, r.wednesday, r.thursday, r.friday, r.saturday, r.sunday]) */ suite.T().Log("About to run line #140: r.Expr([]interface{}{r.Monday, r.Tuesday, r.Wednesday, r.Thursday, r.Friday, r.Saturday, r.Sunday})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.Monday, r.Tuesday, r.Wednesday, r.Thursday, r.Friday, r.Saturday, r.Sunday}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #140") } { // times/api.yaml line #142 /* ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) */ var expected_ []interface{} = []interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} /* r.expr([r.january, r.february, r.march, r.april, r.may, r.june, r.july, r.august, r.september, r.october, r.november, r.december]) */ suite.T().Log("About to run line #142: r.Expr([]interface{}{r.January, r.February, r.March, r.April, r.May, r.June, r.July, r.August, r.September, r.October, r.November, r.December})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.January, r.February, r.March, r.April, r.May, r.June, r.July, r.August, r.September, r.October, r.November, r.December}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #142") } }
func (suite *TimesConstructorsSuite) TestCases() { suite.T().Log("Running TimesConstructorsSuite: Test basic time arithmetic") { // times/constructors.yaml line #5 /* datetime.fromtimestamp(896571240, r.ast.RqlTzinfo('00:00')) */ var expected_ time.Time = Ast.Fromtimestamp(896571240, Ast.RqlTzinfo("00:00")) /* r.expr(r.epoch_time(896571240)) */ suite.T().Log("About to run line #5: r.Expr(r.EpochTime(896571240))") runAndAssert(suite.Suite, expected_, r.Expr(r.EpochTime(896571240)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // times/constructors.yaml line #11 /* {'stuff':datetime.fromtimestamp(896571240, r.ast.RqlTzinfo('00:00')), 'more':[datetime.fromtimestamp(996571240, r.ast.RqlTzinfo('00:00'))]} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"stuff": Ast.Fromtimestamp(896571240, Ast.RqlTzinfo("00:00")), "more": []interface{}{Ast.Fromtimestamp(996571240, Ast.RqlTzinfo("00:00"))}} /* r.expr({'stuff':r.epoch_time(896571240), 'more':[r.epoch_time(996571240)]}) */ suite.T().Log("About to run line #11: r.Expr(map[interface{}]interface{}{'stuff': r.EpochTime(896571240), 'more': []interface{}{r.EpochTime(996571240)}, })") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"stuff": r.EpochTime(896571240), "more": []interface{}{r.EpochTime(996571240)}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // times/constructors.yaml line #17 /* [datetime.fromtimestamp(796571240, r.ast.RqlTzinfo('00:00')), datetime.fromtimestamp(896571240, r.ast.RqlTzinfo('00:00')), {'stuff':datetime.fromtimestamp(996571240, r.ast.RqlTzinfo('00:00'))}] */ var expected_ []interface{} = []interface{}{Ast.Fromtimestamp(796571240, Ast.RqlTzinfo("00:00")), Ast.Fromtimestamp(896571240, Ast.RqlTzinfo("00:00")), map[interface{}]interface{}{"stuff": Ast.Fromtimestamp(996571240, Ast.RqlTzinfo("00:00"))}} /* r.expr([r.epoch_time(796571240), r.epoch_time(896571240), {'stuff':r.epoch_time(996571240)}]) */ suite.T().Log("About to run line #17: r.Expr([]interface{}{r.EpochTime(796571240), r.EpochTime(896571240), map[interface{}]interface{}{'stuff': r.EpochTime(996571240), }})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{r.EpochTime(796571240), r.EpochTime(896571240), map[interface{}]interface{}{"stuff": r.EpochTime(996571240)}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // times/constructors.yaml line #23 /* {'nested':{'time':datetime.fromtimestamp(896571240, r.ast.RqlTzinfo('00:00'))}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"nested": map[interface{}]interface{}{"time": Ast.Fromtimestamp(896571240, Ast.RqlTzinfo("00:00"))}} /* r.expr({'nested':{'time':r.epoch_time(896571240)}}) */ suite.T().Log("About to run line #23: r.Expr(map[interface{}]interface{}{'nested': map[interface{}]interface{}{'time': r.EpochTime(896571240), }, })") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"nested": map[interface{}]interface{}{"time": r.EpochTime(896571240)}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // times/constructors.yaml line #29 /* [1, "two", ["a", datetime.fromtimestamp(896571240, r.ast.RqlTzinfo('00:00')), 3]] */ var expected_ []interface{} = []interface{}{1, "two", []interface{}{"a", Ast.Fromtimestamp(896571240, Ast.RqlTzinfo("00:00")), 3}} /* r.expr([1, "two", ["a", r.epoch_time(896571240), 3]]) */ suite.T().Log("About to run line #29: r.Expr([]interface{}{1, 'two', []interface{}{'a', r.EpochTime(896571240), 3}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, "two", []interface{}{"a", r.EpochTime(896571240), 3}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // times/constructors.yaml line #35 /* 1 */ var expected_ int = 1 /* r.epoch_time(1).to_epoch_time() */ suite.T().Log("About to run line #35: r.EpochTime(1).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.EpochTime(1).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // times/constructors.yaml line #37 /* -1 */ var expected_ int = -1 /* r.epoch_time(-1).to_epoch_time() */ suite.T().Log("About to run line #37: r.EpochTime(-1).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.EpochTime(-1).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // times/constructors.yaml line #39 /* 1.444 */ var expected_ float64 = 1.444 /* r.epoch_time(1.4444445).to_epoch_time() */ suite.T().Log("About to run line #39: r.EpochTime(1.4444445).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.EpochTime(1.4444445).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // times/constructors.yaml line #42 /* "1970-01-01T00:00:01.444+00:00" */ var expected_ string = "1970-01-01T00:00:01.444+00:00" /* r.epoch_time(1.4444445).to_iso8601() */ suite.T().Log("About to run line #42: r.EpochTime(1.4444445).ToISO8601()") runAndAssert(suite.Suite, expected_, r.EpochTime(1.4444445).ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // times/constructors.yaml line #45 /* 1.444 */ var expected_ float64 = 1.444 /* r.epoch_time(1.4444445).seconds() */ suite.T().Log("About to run line #45: r.EpochTime(1.4444445).Seconds()") runAndAssert(suite.Suite, expected_, r.EpochTime(1.4444445).Seconds(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #45") } { // times/constructors.yaml line #48 /* 10000 */ var expected_ int = 10000 /* r.epoch_time(253430000000).year() */ suite.T().Log("About to run line #48: r.EpochTime(253430000000).Year()") runAndAssert(suite.Suite, expected_, r.EpochTime(253430000000).Year(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } { // times/constructors.yaml line #50 /* err("ReqlQueryLogicError", "Year `10000` out of valid ISO 8601 range [0, 9999].", []) */ var expected_ Err = err("ReqlQueryLogicError", "Year `10000` out of valid ISO 8601 range [0, 9999].") /* r.epoch_time(253430000000).to_iso8601() */ suite.T().Log("About to run line #50: r.EpochTime(253430000000).ToISO8601()") runAndAssert(suite.Suite, expected_, r.EpochTime(253430000000).ToISO8601(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // times/constructors.yaml line #53 /* err("ReqlQueryLogicError", "Error in time logic: Year is out of valid range: 1400..10000.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Error in time logic: Year is out of valid range: 1400..10000.") /* r.epoch_time(253440000000).year() */ suite.T().Log("About to run line #53: r.EpochTime(253440000000).Year()") runAndAssert(suite.Suite, expected_, r.EpochTime(253440000000).Year(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // times/constructors.yaml line #55 /* 253440000000 */ var expected_ int = 253440000000 /* r.epoch_time(253440000000).to_epoch_time() */ suite.T().Log("About to run line #55: r.EpochTime(253440000000).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.EpochTime(253440000000).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // times/constructors.yaml line #57 /* 1400 */ var expected_ int = 1400 /* r.epoch_time(-17980000000).year() */ suite.T().Log("About to run line #57: r.EpochTime(-17980000000).Year()") runAndAssert(suite.Suite, expected_, r.EpochTime(-17980000000).Year(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // times/constructors.yaml line #59 /* err("ReqlQueryLogicError", "Error in time logic: Year is out of valid range: 1400..10000.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Error in time logic: Year is out of valid range: 1400..10000.") /* r.epoch_time(-17990000000).year() */ suite.T().Log("About to run line #59: r.EpochTime(-17990000000).Year()") runAndAssert(suite.Suite, expected_, r.EpochTime(-17990000000).Year(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #59") } { // times/constructors.yaml line #61 /* -17990000000 */ var expected_ int = -17990000000 /* r.epoch_time(-17990000000).to_epoch_time() */ suite.T().Log("About to run line #61: r.EpochTime(-17990000000).ToEpochTime()") runAndAssert(suite.Suite, expected_, r.EpochTime(-17990000000).ToEpochTime(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #61") } // times/constructors.yaml line #65 // cdate = "2013-01-01" suite.T().Log("Possibly executing: var cdate string = '2013-01-01'") cdate := "2013-01-01" _ = cdate // Prevent any noused variable errors // times/constructors.yaml line #66 // dates = ["2013", "2013-01", "2013-01-01", "20130101", "2013-001", "2013001"] suite.T().Log("Possibly executing: var dates []interface{} = []interface{}{'2013', '2013-01', '2013-01-01', '20130101', '2013-001', '2013001'}") dates := []interface{}{"2013", "2013-01", "2013-01-01", "20130101", "2013-001", "2013001"} _ = dates // Prevent any noused variable errors // times/constructors.yaml line #67 // ctime = "13:00:00" suite.T().Log("Possibly executing: var ctime string = '13:00:00'") ctime := "13:00:00" _ = ctime // Prevent any noused variable errors // times/constructors.yaml line #68 // times = ["13", "13:00", "1300", "13:00:00", "13:00:00.000000", "130000.000000"] suite.T().Log("Possibly executing: var times []interface{} = []interface{}{'13', '13:00', '1300', '13:00:00', '13:00:00.000000', '130000.000000'}") times := []interface{}{"13", "13:00", "1300", "13:00:00", "13:00:00.000000", "130000.000000"} _ = times // Prevent any noused variable errors // times/constructors.yaml line #69 // ctz = "+00:00" suite.T().Log("Possibly executing: var ctz string = '+00:00'") ctz := "+00:00" _ = ctz // Prevent any noused variable errors // times/constructors.yaml line #70 // tzs = ["Z", "+00", "+0000", "+00:00"] suite.T().Log("Possibly executing: var tzs []interface{} = []interface{}{'Z', '+00', '+0000', '+00:00'}") tzs := []interface{}{"Z", "+00", "+0000", "+00:00"} _ = tzs // Prevent any noused variable errors // times/constructors.yaml line #71 // cdt = [cdate+"T"+ctime+ctz] suite.T().Log("Possibly executing: var cdt []interface{} = []interface{}{cdate + 'T' + ctime + ctz}") cdt := []interface{}{cdate + "T" + ctime + ctz} _ = cdt // Prevent any noused variable errors // times/constructors.yaml line #81 // bad_dates = ["201301", "2013-0101", "2a13", "2013+01", "2013-01-01.1"] suite.T().Log("Possibly executing: var bad_dates []interface{} = []interface{}{'201301', '2013-0101', '2a13', '2013+01', '2013-01-01.1'}") bad_dates := []interface{}{"201301", "2013-0101", "2a13", "2013+01", "2013-01-01.1"} _ = bad_dates // Prevent any noused variable errors // times/constructors.yaml line #82 // bad_times = ["a3", "13:0000", "13:000", "13:00.00", "130000.00000000a"] suite.T().Log("Possibly executing: var bad_times []interface{} = []interface{}{'a3', '13:0000', '13:000', '13:00.00', '130000.00000000a'}") bad_times := []interface{}{"a3", "13:0000", "13:000", "13:00.00", "130000.00000000a"} _ = bad_times // Prevent any noused variable errors // times/constructors.yaml line #83 // bad_tzs = ["X", "-7", "-07:-1", "+07+01", "PST", "UTC", "Z+00"] suite.T().Log("Possibly executing: var bad_tzs []interface{} = []interface{}{'X', '-7', '-07:-1', '+07+01', 'PST', 'UTC', 'Z+00'}") bad_tzs := []interface{}{"X", "-7", "-07:-1", "+07+01", "PST", "UTC", "Z+00"} _ = bad_tzs // Prevent any noused variable errors }
func (suite *TimesPortionsSuite) TestCases() { suite.T().Log("Running TimesPortionsSuite: accessing portions") // times/portions.yaml line #3 // rt1 = 1375147296.681 suite.T().Log("Possibly executing: var rt1 float64 = 1375147296.681") rt1 := 1375147296.681 _ = rt1 // Prevent any noused variable errors // times/portions.yaml line #4 // rt2 = 1375147296.682 suite.T().Log("Possibly executing: var rt2 float64 = 1375147296.682") rt2 := 1375147296.682 _ = rt2 // Prevent any noused variable errors // times/portions.yaml line #5 // rt3 = 1375147297.681 suite.T().Log("Possibly executing: var rt3 float64 = 1375147297.681") rt3 := 1375147297.681 _ = rt3 // Prevent any noused variable errors // times/portions.yaml line #6 // rt4 = 2375147296.681 suite.T().Log("Possibly executing: var rt4 float64 = 2375147296.681") rt4 := 2375147296.681 _ = rt4 // Prevent any noused variable errors // times/portions.yaml line #7 // rts = [rt1, rt2, rt3, rt4] suite.T().Log("Possibly executing: var rts []interface{} = []interface{}{rt1, rt2, rt3, rt4}") rts := []interface{}{rt1, rt2, rt3, rt4} _ = rts // Prevent any noused variable errors // times/portions.yaml line #9 // t1 = r.epoch_time(rt1) suite.T().Log("Possibly executing: var t1 r.Term = r.EpochTime(rt1)") t1 := r.EpochTime(rt1) _ = t1 // Prevent any noused variable errors // times/portions.yaml line #10 // t2 = r.epoch_time(rt2) suite.T().Log("Possibly executing: var t2 r.Term = r.EpochTime(rt2)") t2 := r.EpochTime(rt2) _ = t2 // Prevent any noused variable errors // times/portions.yaml line #11 // t3 = r.epoch_time(rt3) suite.T().Log("Possibly executing: var t3 r.Term = r.EpochTime(rt3)") t3 := r.EpochTime(rt3) _ = t3 // Prevent any noused variable errors // times/portions.yaml line #12 // t4 = r.epoch_time(rt4) suite.T().Log("Possibly executing: var t4 r.Term = r.EpochTime(rt4)") t4 := r.EpochTime(rt4) _ = t4 // Prevent any noused variable errors // times/portions.yaml line #13 // ts = r.expr([t1, t2, t3, t4]) suite.T().Log("Possibly executing: var ts r.Term = r.Expr([]interface{}{t1, t2, t3, t4})") ts := r.Expr([]interface{}{t1, t2, t3, t4}) _ = ts // Prevent any noused variable errors { // times/portions.yaml line #16 /* ([1375142400, 1375142400, 1375142400, 2375136000]) */ var expected_ []interface{} = []interface{}{1375142400, 1375142400, 1375142400, 2375136000} /* ts.map(lambda x:x.date()).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #16: ts.Map(func(x r.Term) interface{} { return x.Date()}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return x.Date() }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // times/portions.yaml line #20 /* ([0, 0, 0, 0]) */ var expected_ []interface{} = []interface{}{0, 0, 0, 0} /* ts.map(lambda x:x.date().time_of_day()) */ suite.T().Log("About to run line #20: ts.Map(func(x r.Term) interface{} { return x.Date().TimeOfDay()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return x.Date().TimeOfDay() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // times/portions.yaml line #24 /* ([4896.681, 4896.682, 4897.681, 11296.681]) */ var expected_ []interface{} = []interface{}{4896.681, 4896.682, 4897.681, 11296.681} /* ts.map(lambda x:x.time_of_day()) */ suite.T().Log("About to run line #24: ts.Map(func(x r.Term) interface{} { return x.TimeOfDay()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return x.TimeOfDay() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // times/portions.yaml line #29 /* ([[2013, 7, 30, 1, 21, 36.681], [2013, 7, 30, 1, 21, 36.682], [2013, 7, 30, 1, 21, 37.681], [2045, 4, 7, 3, 8, 16.681]]) */ var expected_ []interface{} = []interface{}{[]interface{}{2013, 7, 30, 1, 21, 36.681}, []interface{}{2013, 7, 30, 1, 21, 36.682}, []interface{}{2013, 7, 30, 1, 21, 37.681}, []interface{}{2045, 4, 7, 3, 8, 16.681}} /* ts.map(lambda x:[x.year(), x.month(), x.day(), x.hours(), x.minutes(), x.seconds()]) */ suite.T().Log("About to run line #29: ts.Map(func(x r.Term) interface{} { return []interface{}{x.Year(), x.Month(), x.Day(), x.Hours(), x.Minutes(), x.Seconds()}})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return []interface{}{x.Year(), x.Month(), x.Day(), x.Hours(), x.Minutes(), x.Seconds()} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // times/portions.yaml line #36 /* rts */ var expected_ []interface{} = rts /* ts.map(lambda x:r.time(x.year(), x.month(), x.day(), x.hours(), x.minutes(), x.seconds(), x.timezone())).map(lambda x:x.to_epoch_time()) */ suite.T().Log("About to run line #36: ts.Map(func(x r.Term) interface{} { return r.Time(x.Year(), x.Month(), x.Day(), x.Hours(), x.Minutes(), x.Seconds(), x.Timezone())}).Map(func(x r.Term) interface{} { return x.ToEpochTime()})") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Time(x.Year(), x.Month(), x.Day(), x.Hours(), x.Minutes(), x.Seconds(), x.Timezone()) }).Map(func(x r.Term) interface{} { return x.ToEpochTime() }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // times/portions.yaml line #40 /* 0 */ var expected_ int = 0 /* ts.map(lambda x:r.time(x.year(), x.month(), x.day(), x.hours(), x.minutes(), x.seconds(), x.timezone())).union(ts).map(lambda x:x.to_iso8601()).distinct().count().sub(ts.count()) */ suite.T().Log("About to run line #40: ts.Map(func(x r.Term) interface{} { return r.Time(x.Year(), x.Month(), x.Day(), x.Hours(), x.Minutes(), x.Seconds(), x.Timezone())}).Union(ts).Map(func(x r.Term) interface{} { return x.ToISO8601()}).Distinct().Count().Sub(ts.Count())") runAndAssert(suite.Suite, expected_, ts.Map(func(x r.Term) interface{} { return r.Time(x.Year(), x.Month(), x.Day(), x.Hours(), x.Minutes(), x.Seconds(), x.Timezone()) }).Union(ts).Map(func(x r.Term) interface{} { return x.ToISO8601() }).Distinct().Count().Sub(ts.Count()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // times/portions.yaml line #44 /* [[2, 211], [2, 211], [2, 211], [5, 97]] */ var expected_ []interface{} = []interface{}{[]interface{}{2, 211}, []interface{}{2, 211}, []interface{}{2, 211}, []interface{}{5, 97}} /* ts.map([r.row.day_of_week(), r.row.day_of_year()]) */ suite.T().Log("About to run line #44: ts.Map([]interface{}{r.Row.DayOfWeek(), r.Row.DayOfYear()})") runAndAssert(suite.Suite, expected_, ts.Map([]interface{}{r.Row.DayOfWeek(), r.Row.DayOfYear()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } }