{"size": 497, "ext": "js", "max_stars_repo_path": "tests/test_bloom.js", "max_stars_repo_name": "toastdriven/bloom", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests/test_bloom.js", "max_issues_repo_name": "toastdriven/bloom", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/test_bloom.js", "max_forks_repo_name": "toastdriven/bloom", "max_forks_repo_forks_event_min_datetime": "2020-03-13T22:37:46.000Z", "max_forks_repo_forks_event_max_datetime": "2020-03-13T22:37:46.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 23.6666666667, "max_line_length": 52, "alphanum_fraction": 0.6036217304}
const test = require("tape");

const bloom = require("../src/bloom.js");

test("Testing bloom", function(t) {
  t.plan(6);

  let bf = new bloom.BloomFilter(100);
  t.deepEqual(bf.bits, Array(100).fill(0));

  bf.add("Hello");
  t.equal(bf.bits.filter(v => v === 1).length, 5);

  bf.add("world");
  bf.add("HELLO, YES, THIS IS DOG");
  t.equal(bf.test("Hello"), true);
  t.equal(bf.test("world"), true);
  t.equal(bf.test("HELLO, YES, THIS IS DOG"), true);
  t.equal(bf.test("Welp"), false);
});
