From 29796f0320c03fdf9a0a9c7d270dd1d8b05a98bc Mon Sep 17 00:00:00 2001 From: Andrew Bonventre Date: Tue, 5 Aug 2014 07:23:22 -0700 Subject: [PATCH] =?UTF-8?q?address=20peter=E2=80=99s=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- encoding/varint_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/encoding/varint_test.go b/encoding/varint_test.go index c31555099c95..71c9df14df4d 100644 --- a/encoding/varint_test.go +++ b/encoding/varint_test.go @@ -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) @@ -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) } } }