t/00-basic.t
changeset 71 46ba051d29bd
parent 68 8bc711bdd180
child 72 f095f28db247
equal deleted inserted replaced
70:bb6af74ba8b2 71:46ba051d29bd
     1 use strict;
     1 use strict;
     2 use warnings;
     2 use warnings;
       
     3 
     3 use Test::More qw(no_plan);
     4 use Test::More qw(no_plan);
     4 use File::Temp;
     5 use File::Temp;
     5 
     6 
     6 use_ok 'Exim::Grey' => qw(unseen)
     7 use_ok 'Exim::Grey' => qw(unseen seen) or BAIL_OUT;
     7   or BAIL_OUT;
       
     8 
     8 
     9 my $db = File::Temp->new();
     9 my $db = File::Temp->new();
    10 
    10 
       
    11 is seen('a->x', 1, "$db"), 'no' => 'not seen a->x';
    11 is unseen('a->b', 1, "$db"), 'yes' => 'unseen a->b';
    12 is unseen('a->b', 1, "$db"), 'yes' => 'unseen a->b';
    12 is unseen('a->b', 1, "$db"), 'yes' => 'unseen a->b';
    13 is unseen('a->b', 1, "$db"), 'yes' => 'unseen a->b';
    13 
    14 
    14 is unseen('x->y/1.1.1.1', 1, "$db"), 'yes' => 'unseen x->y/1.1.1.1';
    15 is unseen('x->y/1.1.1.1', 1, "$db"), 'yes' => 'unseen x->y/1.1.1.1';
    15 is unseen('x->y/1.1.1.1', 1, "$db"), 'yes' => 'unseen x->y/1.1.1.1';
    16 is unseen('x->y/1.1.1.1', 1, "$db"), 'yes' => 'unseen x->y/1.1.1.1';
    16 
    17 
    17 # sleep
    18 is unseen('a->b',         0, "$db"), 'no' => 'not unseen a->b';
    18 is unseen('a->b',     0, "$db"), 'no' => 'seen a->b';
    19 is unseen('x->y/1.1.1.1', 0, "$db"), 'no' => 'not unseen x->y/1.1.1.1';
    19 is unseen('x->y/1.1.1.1', 0, "$db"), 'no' => 'seen x->y/1.1.1.1';
    20 is unseen('x->z/1.1.1.1', 0, "$db"), 'no' => 'not unseen x->z/1.1.1.1';
    20 is unseen('x->z/1.1.1.1', 0, "$db"), 'no' => 'seen x->z/1.1.1.1';
    21 is seen('x->z/1.1.1.1', 0, "$db"), 'yes' => 'seen x->z/1.1.1.1';
    21 
    22 
    22 is unseen('a->b', 600, "$db"), 'yes' => 'unseen a->b with 600s delay';
    23 is unseen('a->b', 600, "$db"), 'yes' => 'unseen a->b with 600s delay';
       
    24 is seen('a->b', 600, "$db"), 'no' => 'not seen a->b with 600s delay';