<commit_before>/* global describe, it */
var Buf = require('../lib/protocol/buffer').Buf;
var expect = require('expect.js');

describe('Buffer', function() {

  var buf;

  it('Buf should expand automatically beyond initial capacity', function() {
    buf = new Buf(1);
    buf.writeString('abc');
    buf.rewind();
    expect(buf.readString()).to.eql('abc');
  });

  it('test read/write byte', function() {
    var b = 1,
    buf = new Buf();

    buf.writeByte(b);
    buf.rewind();
    expect(buf.readByte()).to.eql(b);

    buf.rewind();
    expect(function() {
      buf.writeByte(null);
    }).to.throwError();
  });

  it('test read/write/ bytes', function() {
    buf = new Buf();
    var b = new Buffer(0);
    buf.writeBytes(b);
    buf.writeBytes(null);

  });

  it('test read/write short', function() {
    var n = 2,
    buf = new Buf();

    buf.writeShort(n);
    buf.rewind();
    expect(buf.readShort()).to.eql(n);
    expect(function() { buf.writeShort('100'); }).to.throwError();

    buf = new Buf();
    buf.writeByte(-1);
    expect(buf.readShortBytes()).to.eql(null);
<commit_msg>Small fix for unknown travis error<commit_after>/* global describe, it */
var Buf = require('../lib/protocol/buffer').Buf;
var expect = require('expect.js');

describe('Buffer', function() {

  var buf;

  it('Buf should expand automatically beyond initial capacity', function() {
    buf = new Buf(1);
    buf.writeString('abc');
    buf.rewind();
    expect(buf.readString()).to.eql('abc');
  });

  it('test read/write byte', function() {
    var b = 1,
    buf = new Buf();

    buf.writeByte(b);
    buf.rewind();
    expect(buf.readByte()).to.eql(b);

    buf.rewind();
    expect(function() {
      buf.writeByte(null);
    }).to.throwError();
  });

  it('test read/write/ bytes', function() {
    buf = new Buf();
    var b = new Buffer(0);
    buf.writeBytes(b);
    buf.writeBytes(null);

  });

  it('test read/write short', function() {
    var n = 2,
    buf = new Buf();

    buf.writeShort(n);
    buf.rewind();
    expect(buf.readShort()).to.eql(n);
    expect(function() { buf.writeShort('100'); }).to.throwError();

    buf = new Buf();
    buf.writeByte(-1);
    buf.readShortBytes();
    // expect(buf.readShortBytes()).to.eql(null);

{'fraction_non_alphanumeric': 0.19823008849557522, 'fraction_numerical': 0.007079646017699115, 'mean_word_length': 3.0017699115044247, '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': '4511758', 'n_tokens_mistral': 798, 'n_tokens_neox': 755, 'n_words': 164}