b1e9.SetInt64(1e9)
testOne := func(ti, tns, di int64) bool {
+ t.Helper()
+
t0 := Unix(ti, int64(tns)).UTC()
d := Duration(di)
if d < 0 {
for i := 0; i < int(b); i++ {
d *= 5
}
+
+ // Make room for unix ↔ internal conversion.
+ // We don't care about behavior too close to ± 2^63 Unix seconds.
+ // It is full of wraparounds but will never happen in a reasonable program.
+ // (Or maybe not? See go.dev/issue/20678. In any event, they're not handled today.)
+ ti >>= 1
+
return testOne(ti, int64(tns), int64(d))
}
quick.Check(f1, cfg)
if d < 0 {
d = -d
}
+ ti >>= 1 // see comment in f1
return testOne(ti, int64(tns), int64(d))
}
quick.Check(f2, cfg)
// full generality
f4 := func(ti int64, tns int32, di int64) bool {
+ ti >>= 1 // see comment in f1
return testOne(ti, int64(tns), di)
}
quick.Check(f4, cfg)