Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jacobsa-fuse
Commits
c1af0dbd
Commit
c1af0dbd
authored
Dec 19, 2016
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TestOutMessageAppend
parent
e7b9860f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletion
+29
-1
internal/buffer/out_message_test.go
internal/buffer/out_message_test.go
+29
-1
No files found.
internal/buffer/out_message_test.go
View file @
c1af0dbd
package
buffer
package
buffer
import
(
import
(
"bytes"
"crypto/rand"
"crypto/rand"
"fmt"
"fmt"
"io"
"io"
...
@@ -87,7 +88,34 @@ func TestMemclr(t *testing.T) {
...
@@ -87,7 +88,34 @@ func TestMemclr(t *testing.T) {
}
}
func
TestOutMessageAppend
(
t
*
testing
.
T
)
{
func
TestOutMessageAppend
(
t
*
testing
.
T
)
{
t
.
Fatal
(
"TODO"
)
var
om
OutMessage
om
.
Reset
()
// Append some payload.
const
wantPayloadStr
=
"tacoburrito"
wantPayload
:=
[]
byte
(
wantPayloadStr
)
om
.
Append
(
wantPayload
[
:
4
])
om
.
Append
(
wantPayload
[
4
:
])
// The result should be a zeroed header followed by the desired payload.
const
wantLen
=
int
(
OutMessageInitialSize
)
+
len
(
wantPayloadStr
)
if
got
,
want
:=
om
.
Len
(),
wantLen
;
got
!=
want
{
t
.
Errorf
(
"om.Len() = %d, want %d"
,
got
,
want
)
}
b
:=
om
.
Bytes
()
if
got
,
want
:=
len
(
b
),
wantLen
;
got
!=
want
{
t
.
Fatalf
(
"len(om.Bytes()) = %d, want %d"
,
got
,
want
)
}
want
:=
append
(
make
([]
byte
,
OutMessageInitialSize
),
wantPayload
...
)
if
!
bytes
.
Equal
(
b
,
want
)
{
t
.
Error
(
"messages differ"
)
}
}
}
func
TestOutMessageAppendString
(
t
*
testing
.
T
)
{
func
TestOutMessageAppendString
(
t
*
testing
.
T
)
{
...
...
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