<commit_before>var LimitableMap = require('../limitablemap.js');

describe("Limitable Map", function () {
  var cache = new LimitableMap(5);

  it('should increase normally', function () {
    Object.keys(cache.map).should.have.length(0);
    cache.set("key1", "key1");
    Object.keys(cache.map).should.have.length(1);
    cache.set("key2", "key2");
    Object.keys(cache.map).should.have.length(2);
    cache.set("key3", "key3");
    Object.keys(cache.map).should.have.length(3);
    cache.set("key4", "key4");
    Object.keys(cache.map).should.have.length(4);
    cache.set("key5", "key5");
    Object.keys(cache.map).should.have.length(5);
  });

  it('should increase limited', function () {
    cache.get("key1").should.be.equal("key1");
    cache.set("key6", "key6");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key1") === undefined).should.be.ok;
    cache.set("key7", "key7");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key2") === undefined).should.be.ok;
    cache.set("key8", "key8");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key3") === undefined).should.be.ok;
    cache.set("key9", "key9");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key4") === undefined).should.be.ok;
    cache.set("key10", "key10");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key5") === undefined).should.be.ok;
  });
});<commit_msg>Update test case for check the hasOwnProperty.<commit_after>var LimitableMap = require('../limitablemap.js');

describe("Limitable Map", function () {
  var cache = new LimitableMap(5);

  it('should increase normally', function () {
    Object.keys(cache.map).should.have.length(0);
    cache.set("key1", "key1");
    Object.keys(cache.map).should.have.length(1);
    cache.set("key2", "key2");
    Object.keys(cache.map).should.have.length(2);
    cache.set("key3", "key3");
    Object.keys(cache.map).should.have.length(3);
    cache.set("key4", "key4");
    Object.keys(cache.map).should.have.length(4);
    cache.set("key5", "key5");
    Object.keys(cache.map).should.have.length(5);
  });

  it('should increase limited', function () {
    cache.get("key1").should.be.equal("key1");
    cache.set("key6", "key6");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key1") === undefined).should.be.ok;
    cache.set("key7", "key7");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key2") === undefined).should.be.ok;
    cache.set("key8", "key8");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key3") === undefined).should.be.ok;
    cache.set("key9", "key9");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key4") === undefined).should.be.ok;
    cache.set("key10", "key10");
    Object.keys(cache.map).should.have.length(5);
    (cache.get("key5") === undefined).should.be.ok;
  });

  it('should set correctly when set hasOwnProperty', function () {
    cache.set("hasOwnProperty", "hasOwnProperty");
    (function(){
      cache.set("whatever", "whatever");
    }).should.not.throw();
  });
});
{'fraction_non_alphanumeric': 0.22561956871580302, 'fraction_numerical': 0.026392018023817188, 'mean_word_length': 3.933333333333333, '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': '4572953', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1099, 'n_words': 139}