Skip to content

Instantly share code, notes, and snippets.

@jb55
Created May 8, 2011 16:02
Show Gist options
  • Select an option

  • Save jb55/961458 to your computer and use it in GitHub Desktop.

Select an option

Save jb55/961458 to your computer and use it in GitHub Desktop.
vows coffee
vows.describe('binary-simple').addBatch
'a number':
topic: new Buffer [0x74, 0x01, 0x00, 0x01]
'with a big endian byte order':
'parses correctly': (buf) ->
res = binary.be buf, 3
assert.equal res, 7602432
'parses correctly with offset': (buf) ->
res = binary.be buf, 2, 1
assert.equal res, 256
'with a little endian byte order':
'parses correctly': (buf) ->
assert.isTrue(false, "not yet implemented")
.export(module)
vows.describe('binary-simple').addBatch({
'a number': {
topic: new Buffer([0x74, 0x01, 0x00, 0x01]),
'with a big endian byte order': {
'parses correctly': function(buf) {
var res;
res = binary.be(buf, 3);
return assert.equal(res, 7602432);
},
'parses correctly with offset': function(buf) {
var res;
res = binary.be(buf, 2, 1);
return assert.equal(res, 256);
}
},
'with a little endian byte order': {
'parses correctly': function(buf) {
return assert.isTrue(false, "not yet implemented");
}
}
}
}).export(module);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment