<commit_before>'use strict';

const InputBuffer = require('..').InputBuffer;

describe('InputBuffer class', function () {
    const data = new Uint32Array([0xff00ff00, 0x00ff00ff]);
    let buffer;
    beforeEach(function () {
        buffer = new InputBuffer(data);
    });

    it('construct', function () {
        // ArrayBuffer
        var buffer = new InputBuffer(new ArrayBuffer(4));
        buffer.length.should.equal(4);
        // Typed array
        buffer = new InputBuffer(new Uint8Array(2));
        buffer.length.should.equal(2);
        buffer = new InputBuffer(new Uint16Array(2));
        buffer.length.should.equal(4);
        // Node.js buffer
        buffer = new InputBuffer(new require('buffer').SlowBuffer(5));
        buffer.length.should.equal(5);
    });

    it('readBoolean', function () {
        buffer.readBoolean().should.be.false();
        buffer.readBoolean().should.be.true();
        buffer.readBoolean().should.be.false();
        buffer.readBoolean().should.be.true();
    });

    it('readInt8', function () {<commit_msg>update test to use Buffer instead of SlowBuffer<commit_after>'use strict';

const InputBuffer = require('..').InputBuffer;
const Buffer = require('buffer').Buffer;

describe('InputBuffer class', function () {
    const data = new Uint32Array([0xff00ff00, 0x00ff00ff]);
    let buffer;
    beforeEach(function () {
        buffer = new InputBuffer(data);
    });

    it('construct', function () {
        // ArrayBuffer
        var buffer = new InputBuffer(new ArrayBuffer(4));
        buffer.length.should.equal(4);
        // Typed array
        buffer = new InputBuffer(new Uint8Array(2));
        buffer.length.should.equal(2);
        buffer = new InputBuffer(new Uint16Array(2));
        buffer.length.should.equal(4);
        // Node.js buffer
        buffer = new InputBuffer(new Buffer(5));
        buffer.length.should.equal(5);
    });

    it('readBoolean', function () {
        buffer.readBoolean().should.be.false();
        buffer.readBoolean().should.be.true();
        buffer.readBoolean().should.be.false();
        buffer.readBoolean().should.be.true();
    });

    it('readInt8', function () {
{'fraction_non_alphanumeric': 0.1515847496554892, 'fraction_numerical': 0.022048690858980247, 'mean_word_length': 2.7422680412371134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1636475', 'n_tokens_mistral': 645, 'n_tokens_neox': 621, 'n_words': 120}