File: check.t

package info (click to toggle)
libbloom-filter-perl 1.2-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 144 kB
  • sloc: perl: 166; makefile: 7
file content (21 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl -w

use Test::More;

use Bloom::Filter;

my $bf = Bloom::Filter->new();

# default capacity should be 100;

my @salts = $bf->salts();
is( scalar @salts, 10, "Correct default number of salts" );

my @keys = qw/Hansel Gretel/;

ok( $bf->add( @keys ), "Added key" );
ok( $bf->check( "Hansel" ), "Found key 'Hansel' in filter" );
ok( !$bf->check( "Herman" ), "Did not find key 'Herman'" );
ok( $bf->check( "Gretel" ), "Found key 'Gretel' in filter" );

done_testing();