<commit_before>/*global describe, it, before */

"use strict";

var buster = require("buster");
var RUList = require("../lib/RUList");

buster.spec.expose();
var expect = buster.expect;

describe("Recently-Used List", function() {
    before(function() {
        this.list = new RUList();
    });

    it("is initially empty", function() {
        expect(this.list.length).toEqual(0);
    });

    it("adds items in reverse order", function() {
        this.list.add('one');
        this.list.add('two');
        this.list.add('three');

        expect(this.list.get(0)).toEqual('three');
        expect(this.list.get(1)).toEqual('two');
        expect(this.list.get(2)).toEqual('one');
        expect(this.list.length).toEqual(3);
    });

    it("doesn't repeat items", function() {
        this.list.add('one');
        this.list.add('two');
        this.list.add('one');

        expect(this.list.get(0)).toEqual('one');
        expect(this.list.get(1)).toEqual('two');
        expect(this.list.length).toEqual(2);
    });

    it("size limit", function() {
        for (var i=0; i < 10; i++) {
            this.list.add('item-' + i);
        }        
        this.list.add('item-2');

        expect(this.list.get(0)).toEqual('item-2');
        expect(this.list.get(1)).toEqual('item-9');        
        expect(this.list.get(9)).toEqual('item-1');
        expect(this.list.length).toEqual(10);
    });

    it("empty items", function() {
        this.list.add('');
        this.list.add(false);
        this.list.add(0);
        this.list.add(null);
        expect(this.list.length).toEqual(4);
    });
});
<commit_msg>better names<commit_after>/*global describe, it, before */

"use strict";

var buster = require("buster");
var RUList = require("../lib/RUList");

buster.spec.expose();
var expect = buster.expect;

describe("Recently-Used List", function() {
    before(function() {
        this.list = new RUList();
    });

    it("is initially empty", function() {
        expect(this.list.length).toEqual(0);
    });

    it("adds items in reverse order", function() {
        this.list.add('one');
        this.list.add('two');
        this.list.add('three');

        expect(this.list.get(0)).toEqual('three');
        expect(this.list.get(1)).toEqual('two');
        expect(this.list.get(2)).toEqual('one');
        expect(this.list.length).toEqual(3);
    });

    it("doesn't repeat items", function() {
        this.list.add('one');
        this.list.add('two');
        this.list.add('one');

        expect(this.list.get(0)).toEqual('one');
        expect(this.list.get(1)).toEqual('two');
        expect(this.list.length).toEqual(2);
    });

    it("remove repeated over 10", function() {
        for (var i=0; i < 10; i++) {
            this.list.add('item-' + i);
        }        
        this.list.add('item-2');

        expect(this.list.length).toEqual(10);
        expect(this.list.get(0)).toEqual('item-2');
        expect(this.list.get(1)).toEqual('item-9');        
        expect(this.list.get(9)).toEqual('item-1');
    });

    it("add false items", function() {
        this.list.add('');
        this.list.add(false);
        this.list.add(0);
        this.list.add(null);
        expect(this.list.length).toEqual(4);
    });
});

{'fraction_non_alphanumeric': 0.20807833537331702, 'fraction_numerical': 0.014075887392900856, 'mean_word_length': 2.3805584281282317, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7313789', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1072, 'n_words': 154}