Permalink
Browse files

more passing checks

  • Loading branch information...
substack committed Nov 1, 2012
1 parent 783d490 commit 897eac1ec6f4a255579bdb87fa7697495d840431
Showing with 11 additions and 3 deletions.
  1. +11 −3 test/bits.js
View
@@ -2,10 +2,18 @@ var test = require('tap').test;
var toggle = require('../');
test('toggle some endians', function (t) {
- var buf = new Buffer('abcd');
+ var buf4 = new Buffer('abcd');
+ var buf6 = new Buffer('abcdef');
+ var buf12 = new Buffer('abcdefghijkl');
- t.equal(toggle(buf, 16).toString(), 'badc');
- t.equal(buf.toString(), 'abcd');
+ t.equal(toggle(buf4, 16).toString(), 'badc');
+ t.equal(buf4.toString(), 'abcd');
+
+ t.throws(function () {
+ toggle(buf6, 32);
+ }, 'non-aligned offset');
+
+ t.equal(toggle(buf12, 24).toString(), 'cbafedihglkj');
t.end('ian');
});

0 comments on commit 897eac1

Please sign in to comment.