From: Jarkko Hietaniemi Date: Sun, 25 Mar 2001 04:03:50 +0000 (+0000) Subject: Put back the MD5-Base64 tests now that we have MIME::Base64. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d5cc3322517048132902b777d962f6cf57559f1;p=p5sagit%2Fp5-mst-13.2.git Put back the MD5-Base64 tests now that we have MIME::Base64. p4raw-id: //depot/perl@9335 --- diff --git a/t/lib/md5-file.t b/t/lib/md5-file.t index a5b726b..b9c51e0 100644 --- a/t/lib/md5-file.t +++ b/t/lib/md5-file.t @@ -6,7 +6,7 @@ BEGIN { print "1..2\n"; use strict; -use Digest::MD5 qw(md5 md5_hex); +use Digest::MD5 qw(md5 md5_hex md5_base64); # # This is the output of: 'md5sum MD5.pm MD5.xs' @@ -25,6 +25,14 @@ $EXPECT = <catfile($path, $last); my $md5bin = pack("H*", $md5hex); + my $md5b64; + if ($B64) { + $md5b64 = MIME::Base64::encode($md5bin, ""); + chop($md5b64); chop($md5b64); # remove padding + } my $failed; if (digest_file($file, 'digest') ne $md5bin) { @@ -51,6 +64,11 @@ for (split /^/, $EXPECT) { $failed++; } + if ($B64 && digest_file($file, 'b64digest') ne $md5b64) { + print "$file: Bad b64digest\n"; + $failed++; + } + my $data = cat_file($file); if (md5($data) ne $md5bin) { print "$file: md5() failed\n"; @@ -60,6 +78,10 @@ for (split /^/, $EXPECT) { print "$file: md5_hex() failed\n"; $failed++; } + if ($B64 && md5_base64($data) ne $md5b64) { + print "$file: md5_base64() failed\n"; + $failed++; + } if (Digest::MD5->new->add($data)->digest ne $md5bin) { print "$file: MD5->new->add(...)->digest failed\n"; @@ -69,6 +91,10 @@ for (split /^/, $EXPECT) { print "$file: MD5->new->add(...)->hexdigest failed\n"; $failed++; } + if ($B64 && Digest::MD5->new->add($data)->b64digest ne $md5b64) { + print "$file: MD5->new->add(...)->b64digest failed\n"; + $failed++; + } my @data = split //, $data; if (md5(@data) ne $md5bin) {