Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: common/recordio/size_test.go

Issue 1904503003: LogDog: Fix archived log stream read errors. (Closed) Base URL: https://github.com/luci/luci-go@hierarchy-check-first
Patch Set: Delete "offset()" method. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « common/recordio/size.go ('k') | server/logdog/storage/archive/storage.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package recordio
6
7 import (
8 "bytes"
9 "fmt"
10 "io/ioutil"
11 "testing"
12
13 . "github.com/smartystreets/goconvey/convey"
14 )
15
16 func TestFrameHeaderSize(t *testing.T) {
17 t.Parallel()
18
19 Convey(`Testing FrameHeaderSize`, t, func() {
20 prev := -1
21 for i := 0; i < 5; i++ {
22 base := 1 << uint(7*i)
23 for delta := range []int{-1, 0, 1} {
24 base += delta
25 if base <= prev {
26 continue
27 }
28 prev = base
29
30 Convey(fmt.Sprintf(`Is accurate for buffer size %d.`, base), func() {
31 data := bytes.Repeat([]byte{0x55}, base)
32
33 amt, err := WriteFrame(ioutil.Discard, d ata)
34 if err != nil {
35 panic(err)
36 }
37
38 So(amt-len(data), ShouldEqual, FrameHead erSize(int64(len(data))))
39 })
40 }
41 }
42 })
43 }
OLDNEW
« no previous file with comments | « common/recordio/size.go ('k') | server/logdog/storage/archive/storage.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698