node-qrcode-lite/test/unit/core/bit-buffer.test.js
Vincenzo Greco 77064f5e5e Refactor/core ()
* Split core lib into multiple files

* Refactor data encoding methods

* Refactor data masking process

* Improve qr code generation process

* Increase minimum required node version to 0.10

* Add linter

* Add tests and tests coverage

* Update travis config to fix compilation issues

* Add examples folder

* Add missing license tag in package.json

* Update build script and add sourcemap support

* Publish only strictly needed files on npm

* Update readme
2016-12-16 23:45:08 +01:00

20 lines
561 B
JavaScript

var test = require('tap').test
var BitBuffer = require('core/bit-buffer')
test('Bit Buffer', function (t) {
var testData = 0x41 // 'A'
var expectedDataBits = [false, true, false, false, false, false, false, true]
var bitBuffer = new BitBuffer()
t.equal(bitBuffer.getLengthInBits(), 0, 'Initial length should be 0')
bitBuffer.put(testData, 8)
t.equal(bitBuffer.getLengthInBits(), 8, 'Length should be 8')
for (var i = 0; i < 8; i++) {
t.deepEqual(bitBuffer.get(i), expectedDataBits[i], 'Should return correct bit value')
}
t.end()
})