3230762041
* adds comment * runs deps * creates boltdb kademlia routing table * protobuf updates * adds reverselist to mockkeyvaluestore interface * xor wip * xor wip * fixes xor sort * runs go fmt * fixes * goimports again * trying to fix travis tests * fixes mock tests
44 lines
726 B
Go
44 lines
726 B
Go
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package ranger
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRange(t *testing.T) {
|
|
for _, tt := range []struct {
|
|
name string
|
|
offset int64
|
|
length int64
|
|
size int64
|
|
}{
|
|
{
|
|
name: "Negative offset",
|
|
offset: -2,
|
|
},
|
|
|
|
{
|
|
name: "Negative length",
|
|
offset: 2,
|
|
length: -1,
|
|
},
|
|
} {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
rr := readerAtRanger{size: tt.size}
|
|
closer, err := rr.Range(context.Background(), tt.offset, tt.length)
|
|
assert.Nil(t, closer)
|
|
assert.NotNil(t, err)
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestClose(t *testing.T) {
|
|
rr := readerAtReader{length: 0}
|
|
assert.Nil(t, rr.Close())
|
|
}
|