<commit_before>'use strict';

var BForest = require('../bforest');
var expect = require('chai').expect;

expect(BForest).to.not.equal(null);

describe('the BForest data structure', function() {
  it('should be empty when created', function() {
    expect(new BForest().isEmpty()).to.be.true;
  });

  it('empty.head() should be null', function() {
    expect(new BForest().head()).to.be.null;
  });

  it('empty.tail() should not be null', function() {
    expect(new BForest().tail()).to.not.be.null;
  });

  it('empty.tail() should be empty', function() {
    expect(new BForest().tail().isEmpty()).to.be.true;
  });

  describe('prints just like a list', function() {
    it('empty is []', function() {
      expect(new BForest().toString()).to.equal('[]');
    });

    var oneTwoThree = new BForest().prepend([1, 2, 3]);
    it('prepending [1, 2, 3] to [] should make [1, 2, 3]', function() {
      expect(oneTwoThree.toString()).to.equal('[1, 2, 3]');
    });

    it('the head of [1, 2, 3] should be 1', function() {
      expect(oneTwoThree.head()).to.equal(1);
    });

    it('the tail of [1, 2, 3] should be [2, 3]', function() {
      expect(oneTwoThree.tail().toString()).to.equal('[2, 3]');
    });
  });
});<commit_msg>add 1 more .head()/.tail() test, add 2 tests for .cons(..)<commit_after>'use strict';

var BForest = require('../bforest');
var expect = require('chai').expect;

expect(BForest).to.not.equal(null);

describe('the BForest data structure', function() {
  it('should be empty when created', function() {
    expect(new BForest().isEmpty()).to.be.true;
  });

  it('empty.head() should be null', function() {
    expect(new BForest().head()).to.be.null;
  });

  it('empty.tail() should not be null', function() {
    expect(new BForest().tail()).to.not.be.null;
  });

  it('empty.tail() should be empty', function() {
    expect(new BForest().tail().isEmpty()).to.be.true;
  });

  describe('prints just like a list', function() {
    it('empty is []', function() {
      expect(new BForest().toString()).to.equal('[]');
    });

    var oneTwoThree = new BForest().prepend([1, 2, 3]);
    it('prepending [1, 2, 3] to [] should make [1, 2, 3]', function() {
      expect(oneTwoThree.toString()).to.equal('[1, 2, 3]');
    });

    it('the head of [1, 2, 3] should be 1', function() {
      expect(oneTwoThree.head()).to.equal(1);
    });

    it('the tail of [1, 2, 3] should be [2, 3]', function() {
      expect(oneTwoThree.tail().toString()).to.equal('[2, 3]');
    });

    it('the head of the tail of [1, 2, 3] should be 2', function() {
      expect(oneTwoThree.tail().head()).to.equal(2);
    });
  });

  describe('conses just like a list', function() {
    it('1 cons [] should be [1]', function() {
      expect(new BForest().cons(1).toString()).to.equal('[1]');
    });

    it('1 cons 2 cons [] should be [1, 2]', function() {
      expect(new BForest().cons(2).cons(1).toString()).to.equal('[1, 2]');
    });
  });
});
{'fraction_non_alphanumeric': 0.2304318488529015, 'fraction_numerical': 0.02260458839406208, 'mean_word_length': 3.425373134328358, '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': '6774567', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1014, 'n_words': 247}