]> zoso.dev Git - buffer.git/commitdiff
add failing test for write return offset
authorFeross Aboukhadijeh <feross@feross.org>
Thu, 8 May 2014 00:24:50 +0000 (17:24 -0700)
committerFeross Aboukhadijeh <feross@feross.org>
Thu, 8 May 2014 00:24:50 +0000 (17:24 -0700)
test/buffer.js

index bff5f3b558c4d126c30d8ae17c3776b9b20225e9..24b3f66d9ecc85b1d4df27df61260473b5be7f3f 100644 (file)
@@ -194,6 +194,16 @@ test('hex of write{Uint,Int}{8,16,32}{LE,BE} with overflow', function (t) {
     t.end()
 })
 
+test('test offset returns are correct', function (t) {
+  var b = new B(16)
+  t.equal(4, b.writeUInt32LE(0, 0))
+  t.equal(6, b.writeUInt16LE(0, 4))
+  t.equal(7, b.writeUInt8(0, 6))
+  t.equal(8, b.writeInt8(0, 7))
+  t.equal(16, b.writeDoubleLE(0, 8))
+  t.end()
+})
+
 test('concat() a varying number of buffers', function (t) {
   var zero = []
   var one  = [ new B('asdf') ]