moolb-js

Bloom filter for javascript with pluggable hasher backend
git clone git://git.defalsify.org/moolb-js.git
Info | Log | Files | Refs | README

test_moolb.js (367B)


      1 let moolb = require('../moolb/moolb');
      2 let assert = require('assert');
      3 
      4 describe('check', () => {
      5 	it('builtin', async () => {
      6 		let ref = b = new moolb.Bloom(8192 * 8, 3);
      7 		let enc = new TextEncoder();
      8 
      9 		let v = enc.encode('1024');
     10 		await b.add(v);
     11 		let r = await b.check(v);
     12 		assert(r);
     13 
     14 		v = enc.encode('1023');
     15 		r = await b.check(v);
     16 		assert(!r)
     17 	});
     18 });