perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestAPR brigade.pm
Date Fri, 21 May 2004 18:39:05 GMT
stas        2004/05/21 11:39:05

  Modified:    t/response/TestAPR brigade.pm
  Log:
  more APR::Brigade tests
  
  Revision  Changes    Path
  1.2       +53 -18    modperl-2.0/t/response/TestAPR/brigade.pm
  
  Index: brigade.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/brigade.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- brigade.pm	28 Jan 2004 13:54:21 -0000	1.1
  +++ brigade.pm	21 May 2004 18:39:05 -0000	1.2
  @@ -1,5 +1,10 @@
   package TestAPR::brigade;
   
  +# testing APR::Brigade in this tests.
  +# Other tests do that too:
  +# TestAPR::flatten : flatten()
  +# TestAPR::bucket  : empty(), first(), last()
  +
   use strict;
   use warnings FATAL => 'all';
   
  @@ -15,25 +20,55 @@
   
       my $r = shift;
   
  -    plan $r, tests => 4;
  -
  -    # simple constructor and accessor tests
  -
  -    my $bb = APR::Brigade->new($r->pool, $r->connection->bucket_alloc);
  -
  -    t_debug('$bb is defined');
  -    ok defined $bb;
  -
  -    t_debug('$bb ISA APR::Brigade object');
  -    ok $bb->isa('APR::Brigade');
  -
  -    my $pool = $bb->pool;
  -
  -    t_debug('$pool is defined');
  -    ok defined $pool;
  +    plan $r, tests => 9;
   
  -    t_debug('$pool ISA APR::Pool object');
  -    ok $pool->isa('APR::Pool');
  +    # basic + pool + destroy
  +    {
  +        my $bb = APR::Brigade->new($r->pool, $r->connection->bucket_alloc);
  +
  +        t_debug('$bb is defined');
  +        ok defined $bb;
  +
  +        t_debug('$bb ISA APR::Brigade object');
  +        ok $bb->isa('APR::Brigade');
  +
  +        my $pool = $bb->pool;
  +
  +        t_debug('$pool is defined');
  +        ok defined $pool;
  +
  +        t_debug('$pool ISA APR::Pool object');
  +        ok $pool->isa('APR::Pool');
  +
  +        t_debug("destroy");
  +        $bb->destroy;
  +        ok 1;
  +    }
  +
  +    # concat / split / length / flatten
  +    {
  +        my $bb1 = APR::Brigade->new($r->pool, $r->connection->bucket_alloc);
  +        $bb1->insert_head(APR::Bucket->new("11"));
  +        $bb1->insert_tail(APR::Bucket->new("12"));
  +
  +        my $bb2 = APR::Brigade->new($r->pool, $r->connection->bucket_alloc);
  +        $bb2->insert_head(APR::Bucket->new("21"));
  +        $bb2->insert_tail(APR::Bucket->new("22"));
  +
  +        # concat
  +        $bb1->concat($bb2);
  +        # bb1: 11, 12, 21, 22
  +        ok t_cmp(8, $bb1->length, "total data length in bb");
  +        ok t_cmp("11122122", $bb1->flatten, "bb flatten");
  +
  +        # split
  +        my $b = $bb1->first; # 11
  +        $b = $bb1->next($b); # 12
  +        my $bb3 = $bb1->split($b);
  +        # bb1: 11, bb3: 12, 21, 22
  +        ok t_cmp("11",     $bb1->flatten, "bb flatten");
  +        ok t_cmp("122122", $bb3->flatten, "bb flatten");
  +    }
   
       Apache::OK;
   }
  
  
  

Mime
View raw message