aboutsummaryrefslogtreecommitdiffstats
path: root/utils/binary/writer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/binary/writer_test.go')
-rw-r--r--utils/binary/writer_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/binary/writer_test.go b/utils/binary/writer_test.go
index 88140a1..1380280 100644
--- a/utils/binary/writer_test.go
+++ b/utils/binary/writer_test.go
@@ -41,3 +41,19 @@ func (s *BinarySuite) TestWriteUint16(c *C) {
c.Assert(err, IsNil)
c.Assert(buf, DeepEquals, expected)
}
+
+func (s *BinarySuite) TestWriteVariableWidthInt(c *C) {
+ buf := bytes.NewBuffer(nil)
+
+ err := WriteVariableWidthInt(buf, 366)
+ c.Assert(err, IsNil)
+ c.Assert(buf.Bytes(), DeepEquals, []byte{129, 110})
+}
+
+func (s *BinarySuite) TestWriteVariableWidthIntShort(c *C) {
+ buf := bytes.NewBuffer(nil)
+
+ err := WriteVariableWidthInt(buf, 19)
+ c.Assert(err, IsNil)
+ c.Assert(buf.Bytes(), DeepEquals, []byte{19})
+}