Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-chunker
Commits
cbd0b2e1
Commit
cbd0b2e1
authored
Mar 26, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix lints
parent
cbf45fd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
buzhash_test.go
buzhash_test.go
+7
-1
rabin_test.go
rabin_test.go
+14
-2
No files found.
buzhash_test.go
View file @
cbd0b2e1
...
@@ -9,7 +9,13 @@ import (
...
@@ -9,7 +9,13 @@ import (
)
)
func
testBuzhashChunking
(
t
*
testing
.
T
,
buf
[]
byte
)
(
chunkCount
int
)
{
func
testBuzhashChunking
(
t
*
testing
.
T
,
buf
[]
byte
)
(
chunkCount
int
)
{
util
.
NewTimeSeededRand
()
.
Read
(
buf
)
n
,
err
:=
util
.
NewTimeSeededRand
()
.
Read
(
buf
)
if
n
<
len
(
buf
)
{
t
.
Fatalf
(
"expected %d bytes, got %d"
,
len
(
buf
),
n
)
}
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
r
:=
NewBuzhash
(
bytes
.
NewReader
(
buf
))
r
:=
NewBuzhash
(
bytes
.
NewReader
(
buf
))
...
...
rabin_test.go
View file @
cbd0b2e1
...
@@ -12,7 +12,13 @@ import (
...
@@ -12,7 +12,13 @@ import (
func
TestRabinChunking
(
t
*
testing
.
T
)
{
func
TestRabinChunking
(
t
*
testing
.
T
)
{
data
:=
make
([]
byte
,
1024
*
1024
*
16
)
data
:=
make
([]
byte
,
1024
*
1024
*
16
)
util
.
NewTimeSeededRand
()
.
Read
(
data
)
n
,
err
:=
util
.
NewTimeSeededRand
()
.
Read
(
data
)
if
n
<
len
(
data
)
{
t
.
Fatalf
(
"expected %d bytes, got %d"
,
len
(
data
),
n
)
}
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
r
:=
NewRabin
(
bytes
.
NewReader
(
data
),
1024
*
256
)
r
:=
NewRabin
(
bytes
.
NewReader
(
data
),
1024
*
256
)
...
@@ -62,7 +68,13 @@ func chunkData(t *testing.T, newC newSplitter, data []byte) map[string]blocks.Bl
...
@@ -62,7 +68,13 @@ func chunkData(t *testing.T, newC newSplitter, data []byte) map[string]blocks.Bl
func
testReuse
(
t
*
testing
.
T
,
cr
newSplitter
)
{
func
testReuse
(
t
*
testing
.
T
,
cr
newSplitter
)
{
data
:=
make
([]
byte
,
1024
*
1024
*
16
)
data
:=
make
([]
byte
,
1024
*
1024
*
16
)
util
.
NewTimeSeededRand
()
.
Read
(
data
)
n
,
err
:=
util
.
NewTimeSeededRand
()
.
Read
(
data
)
if
n
<
len
(
data
)
{
t
.
Fatalf
(
"expected %d bytes, got %d"
,
len
(
data
),
n
)
}
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
ch1
:=
chunkData
(
t
,
cr
,
data
[
1000
:
])
ch1
:=
chunkData
(
t
,
cr
,
data
[
1000
:
])
ch2
:=
chunkData
(
t
,
cr
,
data
)
ch2
:=
chunkData
(
t
,
cr
,
data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment