<commit_before>/*global describe:true, it:true, before:true, after:true */

var
    chai       = require('chai'),
    assert     = chai.assert,
    expect     = chai.expect,
    should     = chai.should(),
    Lightcycle = require('../index'),
    Xxhash     = require('xxhash')
    ;


function MockResource(name)
{
    this._name = name;
}

MockResource.prototype.name = function()
{
    return this._name;
};

function makeFruitCycle()
{
    var cycle = new Lightcycle({ size: 10, replicas: 3 });
    var r1 = new MockResource('kiwi');
    var r2 = new MockResource('papaya');
    var r3 = new MockResource('litchi');

    cycle.add(r1, r1.name());
    cycle.add(r2, r2.name());
    cycle.add(r3, r3.name());

    return cycle;
}

describe('light-cycle', function()
{
    describe('constructor', function()
    {
        it('demands a positive integer size setting', function()
        {
            function shouldThrow()
            {
                var cycle = new Lightcycle({ size: -3 });
            }
            shouldThrow.should.throw(Error);
        });

        it('respects the hash seed setting', function()
        {
            var cycle = new Lightcycle({ });
            assert.equal(cycle.seed, 0xcafed00d);
        });
<commit_msg>Corrected test description.<commit_after>/*global describe:true, it:true, before:true, after:true */

var
    chai       = require('chai'),
    assert     = chai.assert,
    expect     = chai.expect,
    should     = chai.should(),
    Lightcycle = require('../index'),
    Xxhash     = require('xxhash')
    ;


function MockResource(name)
{
    this._name = name;
}

MockResource.prototype.name = function()
{
    return this._name;
};

function makeFruitCycle()
{
    var cycle = new Lightcycle({ size: 10, replicas: 3 });
    var r1 = new MockResource('kiwi');
    var r2 = new MockResource('papaya');
    var r3 = new MockResource('litchi');

    cycle.add(r1, r1.name());
    cycle.add(r2, r2.name());
    cycle.add(r3, r3.name());

    return cycle;
}

describe('light-cycle', function()
{
    describe('constructor', function()
    {
        it('demands a positive integer size setting', function()
        {
            function shouldThrow()
            {
                var cycle = new Lightcycle({ size: -3 });
            }
            shouldThrow.should.throw(Error);
        });

        it('provides a default hash seed', function()
        {
            var cycle = new Lightcycle({ });
            assert.equal(cycle.seed, 0xcafed00d);
        });

{'fraction_non_alphanumeric': 0.14551942902458367, 'fraction_numerical': 0.012688342585249802, 'mean_word_length': 2.2346153846153847, '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': '3048153', 'n_tokens_mistral': 795, 'n_tokens_neox': 769, 'n_words': 178}