-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
24 lines (22 loc) · 879 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict';
require('mocha');
const assert = require('assert');
const crc32 = require('./index.js');
describe('crc32', function() {
it('Return hex value for CRC32 of a string foo using a lookup table:', function() {
let result = crc32('foo');
assert.equal(result, "8c736521");
});
it('Return hex value for CRC32 of a string foo using polynomial division:', function() {
let result = crc32('foo', true, true);
assert.equal(result, "8c736521");
});
it('Return decimal value for CRC32 of a string foo using a lookup table:', function() {
let result = crc32('foo', false, false);
assert.equal(result, "2356372769");
});
it('Return decimal value for CRC32 of a string foo using polynomial division:', function() {
let result = crc32('foo', true, false);
assert.equal(result, "2356372769");
});
});