You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ra...@apache.org on 2004/07/15 17:16:50 UTC

cvs commit: modperl-2.0/t/response/TestAPR base64.pm

randyk      2004/07/15 08:16:50

  Modified:    t/response/TestAPR base64.pm
  Added:       t/apr-ext base64.t
               t/lib/TestAPRlib base64.pm
  Log:
  Reviewed by:	stas
  move common base64 tests into t/lib/TestAPRlib/, and
  call them from both t/apr/ and t/apr-ext/.
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/apr-ext/base64.t
  
  Index: base64.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  
  use TestAPRlib::base64;
  
  plan tests => TestAPRlib::base64::num_of_tests();
  
  TestAPRlib::base64::test();
  
  
  
  1.1                  modperl-2.0/t/lib/TestAPRlib/base64.pm
  
  Index: base64.pm
  ===================================================================
  package TestAPRlib::base64;
  
  # testing APR::Base64 API
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use APR::Base64;
  
  sub num_of_tests {
      return 3;
  }
  
  sub test {
  
      my $str = '12345qwert!@#$%';
      my $encoded = APR::Base64::encode($str);
  
      t_debug("encoded string: $encoded");
      ok $encoded;
  
      ok t_cmp(APR::Base64::encode_len(length $str),
               length $encoded,
               "encoded length");
  
      ok t_cmp(APR::Base64::decode($encoded), $str, "decode");
  
  }
  
  1;
  
  
  
  1.5       +5 -16     modperl-2.0/t/response/TestAPR/base64.pm
  
  Index: base64.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/base64.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- base64.pm	8 Jul 2004 06:06:33 -0000	1.4
  +++ base64.pm	15 Jul 2004 15:16:50 -0000	1.5
  @@ -4,28 +4,17 @@
   use warnings FATAL => 'all';
   
   use Apache::Test;
  -use Apache::TestUtil;
  -
  -use APR::Base64 ();
  -
   use Apache::Const -compile => 'OK';
   
  +use TestAPRlib::base64;
  +
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => 3;
  -
  -    my $str = "$r";
  -    my $encoded = APR::Base64::encode($str);
  -
  -    t_debug("encoded string: $encoded");
  -    ok $encoded;
  -
  -    ok t_cmp(APR::Base64::encode_len(length $str),
  -             length $encoded,
  -             "encoded length");
  +    my $num_of_tests = TestAPRlib::base64::num_of_tests();
  +    plan $r, tests => $num_of_tests;
   
  -    ok t_cmp(APR::Base64::decode($encoded), $str, "decode");
  +    TestAPRlib::base64::test();
   
       Apache::OK;
   }