| Total Complexity | 7 |
| Complexity/F | 1 |
| Lines of Code | 28 |
| Function Count | 7 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |