1 |
|
2 |
|
3 |
|
4 | var assert = require('assert');
|
5 | var jsHashes = require('../');
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | var testVectors = {
|
12 | "": 0x00000000,
|
13 | "a": 0xe8b7be43,
|
14 | "abc": 0x352441c2,
|
15 | "abcdefghijklmnopqrstuvwxyz": 0x4c2750bd,
|
16 | "message checksum": 0xf853178f,
|
17 | "The quick brown fox jumps over the lazy dog": 0x414fa339,
|
18 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789": 0x1fc2e6d2
|
19 | };
|
20 |
|
21 | describe('Test CRC32', function() {
|
22 | Object.keys(testVectors).forEach(function(data) {
|
23 | it('should checksum '+JSON.stringify(data)+' correctly', function() {
|
24 | assert.equal(jsHashes.CRC32(data), testVectors[data]);
|
25 | });
|
26 | });
|
27 | });
|