Skip to content

Commit

Permalink
address peter’s comments
Browse files Browse the repository at this point in the history
Summary: small change involving #31

Test Plan: unit tests

Reviewers: spencerkimball, joyt, petermattis

Reviewed By: petermattis

Subscribers: team

Differential Revision: http://phabricator.cockroachdb.org/D132
  • Loading branch information
andybons committed Aug 5, 2014
1 parent 43a9936 commit 29796f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions encoding/varint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ func (p byteSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// TestVarintOrdering ensures that lexicographical and numeric ordering
// for varints are the same
func TestVarintOrdering(t *testing.T) {
rand.Seed(time.Now().Unix())
seed := time.Now().Unix()
rand.Seed(seed)
ints := make(uint64Slice, 50)
varints := make(byteSlice, 50)
varints := make(byteSlice, len(ints))
for i := range ints {
// rand.Uint64() doesn't exist within the stdlib.
// https://groups.google.com/forum/#!topic/golang-nuts/Kle874lT1Eo
val := uint64(rand.Uint32())
val = uint64(rand.Uint32()) + val<<32
val := uint64(rand.Uint32())<<32 + uint64(rand.Uint32())
ints[i] = val
varints[i] = make([]byte, maxVarintSize)
PutUvarint(varints[i], val)
Expand All @@ -97,7 +97,7 @@ func TestVarintOrdering(t *testing.T) {
for i := range ints {
decoded := GetUVarint(varints[i])
if decoded != ints[i] {
t.Errorf("mismatched ordering at index %d: expected: %d, got %d", i, ints[i], decoded)
t.Errorf("mismatched ordering at index %d: expected: %d, got %d [seed: %d]", i, ints[i], decoded, seed)
}
}
}

0 comments on commit 29796f0

Please sign in to comment.