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
9d0e6bcf
Commit
9d0e6bcf
authored
Dec 19, 2017
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for overallocation in chunker
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
03fd98e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
splitting_test.go
splitting_test.go
+14
-0
No files found.
splitting_test.go
View file @
9d0e6bcf
...
...
@@ -22,6 +22,20 @@ func copyBuf(buf []byte) []byte {
return
cpy
}
func
TestSizeSplitterOverAllocate
(
t
*
testing
.
T
)
{
max
:=
1000
r
:=
bytes
.
NewReader
(
randBuf
(
t
,
max
))
chunksize
:=
int64
(
1024
*
256
)
splitter
:=
NewSizeSplitter
(
r
,
chunksize
)
chunk
,
err
:=
splitter
.
NextBytes
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
if
cap
(
chunk
)
>
len
(
chunk
)
{
t
.
Fatal
(
"chunk capacity too large"
)
}
}
func
TestSizeSplitterIsDeterministic
(
t
*
testing
.
T
)
{
if
testing
.
Short
()
{
t
.
SkipNow
()
...
...
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