Passed
Branch master (9a7ed1)
by Rafael S.
01:20
created

test/helpers.js   A

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 28
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 28
rs 10
wmc 7
mnd 0
bc 7
fnc 7
bpm 1
cpm 1
noi 0
1
2
var assert = require('assert');
3
4
describe('helpers', function() {
5
    
6
    let helpers = require('../src/byte-padding.js');
7
8
    // bin
9
    it('should pad 7 bits to a byte', function() {
10
        assert.deepEqual(helpers.bytePadding('1111101', 2), '01111101');
11
    });
12
    it('should pad 6 bits to a byte', function() {
13
        assert.deepEqual(helpers.bytePadding('111101', 2), '00111101');
14
    });
15
    it('should pad 1 bit to a byte', function() {
16
        assert.deepEqual(helpers.bytePadding('1', 2), '00000001');
17
    });
18
    it('should pad 0 bit to a byte', function() {
19
        assert.deepEqual(helpers.bytePadding('0', 2), '00000000');
20
    });
21
22
    // hex
23
    it('should pad 1 hex digit to a byte', function() {
24
        assert.deepEqual(helpers.bytePadding('f', 16), '0f');
25
    });
26
    it('should pad 6 bits to a byte', function() {
27
        assert.deepEqual(helpers.bytePadding('0', 16), '00');
28
    });
29
});
30