summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golang/protobuf/ptypes/duration_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/golang/protobuf/ptypes/duration_test.go')
-rw-r--r--vendor/github.com/golang/protobuf/ptypes/duration_test.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/vendor/github.com/golang/protobuf/ptypes/duration_test.go b/vendor/github.com/golang/protobuf/ptypes/duration_test.go
index e761289f1..e00491a34 100644
--- a/vendor/github.com/golang/protobuf/ptypes/duration_test.go
+++ b/vendor/github.com/golang/protobuf/ptypes/duration_test.go
@@ -52,37 +52,37 @@ var durationTests = []struct {
dur time.Duration
}{
// The zero duration.
- {&durpb.Duration{0, 0}, true, true, 0},
+ {&durpb.Duration{Seconds: 0, Nanos: 0}, true, true, 0},
// Some ordinary non-zero durations.
- {&durpb.Duration{100, 0}, true, true, 100 * time.Second},
- {&durpb.Duration{-100, 0}, true, true, -100 * time.Second},
- {&durpb.Duration{100, 987}, true, true, 100*time.Second + 987},
- {&durpb.Duration{-100, -987}, true, true, -(100*time.Second + 987)},
+ {&durpb.Duration{Seconds: 100, Nanos: 0}, true, true, 100 * time.Second},
+ {&durpb.Duration{Seconds: -100, Nanos: 0}, true, true, -100 * time.Second},
+ {&durpb.Duration{Seconds: 100, Nanos: 987}, true, true, 100*time.Second + 987},
+ {&durpb.Duration{Seconds: -100, Nanos: -987}, true, true, -(100*time.Second + 987)},
// The largest duration representable in Go.
- {&durpb.Duration{maxGoSeconds, int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, true, math.MaxInt64},
+ {&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, true, math.MaxInt64},
// The smallest duration representable in Go.
- {&durpb.Duration{minGoSeconds, int32(math.MinInt64 - 1e9*minGoSeconds)}, true, true, math.MinInt64},
+ {&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, true, math.MinInt64},
{nil, false, false, 0},
- {&durpb.Duration{-100, 987}, false, false, 0},
- {&durpb.Duration{100, -987}, false, false, 0},
- {&durpb.Duration{math.MinInt64, 0}, false, false, 0},
- {&durpb.Duration{math.MaxInt64, 0}, false, false, 0},
+ {&durpb.Duration{Seconds: -100, Nanos: 987}, false, false, 0},
+ {&durpb.Duration{Seconds: 100, Nanos: -987}, false, false, 0},
+ {&durpb.Duration{Seconds: math.MinInt64, Nanos: 0}, false, false, 0},
+ {&durpb.Duration{Seconds: math.MaxInt64, Nanos: 0}, false, false, 0},
// The largest valid duration.
- {&durpb.Duration{maxSeconds, 1e9 - 1}, true, false, 0},
+ {&durpb.Duration{Seconds: maxSeconds, Nanos: 1e9 - 1}, true, false, 0},
// The smallest valid duration.
- {&durpb.Duration{minSeconds, -(1e9 - 1)}, true, false, 0},
+ {&durpb.Duration{Seconds: minSeconds, Nanos: -(1e9 - 1)}, true, false, 0},
// The smallest invalid duration above the valid range.
- {&durpb.Duration{maxSeconds + 1, 0}, false, false, 0},
+ {&durpb.Duration{Seconds: maxSeconds + 1, Nanos: 0}, false, false, 0},
// The largest invalid duration below the valid range.
- {&durpb.Duration{minSeconds - 1, -(1e9 - 1)}, false, false, 0},
+ {&durpb.Duration{Seconds: minSeconds - 1, Nanos: -(1e9 - 1)}, false, false, 0},
// One nanosecond past the largest duration representable in Go.
- {&durpb.Duration{maxGoSeconds, int32(math.MaxInt64-1e9*maxGoSeconds) + 1}, true, false, 0},
+ {&durpb.Duration{Seconds: maxGoSeconds, Nanos: int32(math.MaxInt64-1e9*maxGoSeconds) + 1}, true, false, 0},
// One nanosecond past the smallest duration representable in Go.
- {&durpb.Duration{minGoSeconds, int32(math.MinInt64-1e9*minGoSeconds) - 1}, true, false, 0},
+ {&durpb.Duration{Seconds: minGoSeconds, Nanos: int32(math.MinInt64-1e9*minGoSeconds) - 1}, true, false, 0},
// One second past the largest duration representable in Go.
- {&durpb.Duration{maxGoSeconds + 1, int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, false, 0},
+ {&durpb.Duration{Seconds: maxGoSeconds + 1, Nanos: int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, false, 0},
// One second past the smallest duration representable in Go.
- {&durpb.Duration{minGoSeconds - 1, int32(math.MinInt64 - 1e9*minGoSeconds)}, true, false, 0},
+ {&durpb.Duration{Seconds: minGoSeconds - 1, Nanos: int32(math.MinInt64 - 1e9*minGoSeconds)}, true, false, 0},
}
func TestValidateDuration(t *testing.T) {