Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from visionmedia/master
Buffer support + tests
- Loading branch information
Showing
8 changed files
with
110 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
test: | ||
@./node_modules/.bin/mocha \ | ||
--require should \ | ||
--reporter spec | ||
|
||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,7 @@ or | |
|
||
npm install crc | ||
|
||
## Running tests | ||
|
||
$ npm install | ||
$ make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env ./nodeunit/bin/nodeunit | ||
|
||
var crc = require('../lib/crc'); | ||
|
||
describe('crc8()', function(){ | ||
it('should work with strings', function(){ | ||
crc.crc8('hello world').should.equal(64); | ||
}) | ||
|
||
it('should work with Buffers', function(){ | ||
crc.buffer.crc8(new Buffer('hello world')).should.equal(64); | ||
}) | ||
}) | ||
|
||
describe('crc16()', function(){ | ||
it('should work with strings', function(){ | ||
crc.crc16('hello world').should.equal(15332); | ||
}) | ||
|
||
it('should work with Buffers', function(){ | ||
crc.buffer.crc16(new Buffer('hello world')).should.equal(15332); | ||
}) | ||
}) | ||
|
||
describe('crc32()', function(){ | ||
it('should work with strings', function(){ | ||
crc.crc32('hello world').should.equal(222957957); | ||
}) | ||
|
||
it('should work with Buffers', function(){ | ||
crc.buffer.crc32(new Buffer('hello world')).should.equal(222957957); | ||
}) | ||
}) | ||
|
||
describe('crcArc()', function(){ | ||
it('should work with strings', function(){ | ||
crc.crcArc('hello world').should.equal(14785); | ||
}) | ||
}) | ||
|
||
describe('fcs16()', function(){ | ||
it('should work with strings', function(){ | ||
crc.fcs16('hello world').should.equal(44550); | ||
}) | ||
}) | ||
|
||
describe('hex8()', function(){ | ||
it('should work with strings', function(){ | ||
crc.hex8(64).should.equal('40'); | ||
}) | ||
}) | ||
|
||
describe('hex16()', function(){ | ||
it('should work with strings', function(){ | ||
crc.hex16(15332).should.equal('3BE4'); | ||
}) | ||
}) | ||
|
||
describe('hex32()', function(){ | ||
it('should work with strings', function(){ | ||
crc.hex32(222957957).should.equal('0D4A1185'); | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Submodule nodeunit
deleted from
8a31df