summaryrefslogtreecommitdiff
path: root/ext/Digest
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-05-01 23:40:47 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-01 23:40:47 +0000
commit9508959b48d9beb1fd6a81c01ef5b8896339ebd4 (patch)
tree6aaf8d7c4f6b2e226e26d2cff38d940a26d09542 /ext/Digest
parent5a0465204af83dac035ba461e6e2a04febe9287d (diff)
downloadperl-9508959b48d9beb1fd6a81c01ef5b8896339ebd4.tar.gz
Fix files.t for blead.
p4raw-id: //depot/perl@16322
Diffstat (limited to 'ext/Digest')
-rw-r--r--ext/Digest/MD5/README14
-rw-r--r--ext/Digest/MD5/t/files.t43
2 files changed, 52 insertions, 5 deletions
diff --git a/ext/Digest/MD5/README b/ext/Digest/MD5/README
new file mode 100644
index 0000000000..9ca422119f
--- /dev/null
+++ b/ext/Digest/MD5/README
@@ -0,0 +1,14 @@
+The Digest::MD5 module allows you to use the RSA Data Security
+Inc. MD5 Message Digest algorithm from within Perl programs. The
+algorithm takes as input a message of arbitrary length and produces as
+output a 128-bit "fingerprint" or "message digest" of the input.
+MD5 is described in RFC 1321.
+
+You will need perl version 5.004 or better to install this module.
+
+Copyright 1998-2002 Gisle Aas.
+Copyright 1995-1996 Neil Winton.
+Copyright 1990-1992 RSA Data Security, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t
index b1abe19308..5fcb035e2b 100644
--- a/ext/Digest/MD5/t/files.t
+++ b/ext/Digest/MD5/t/files.t
@@ -1,3 +1,10 @@
+BEGIN {
+ if ($ENV{PERL_CORE}) {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ }
+}
+
print "1..5\n";
use strict;
@@ -6,13 +13,25 @@ use Digest::MD5 qw(md5 md5_hex md5_base64);
#
# This is the output of: 'md5sum Changes README MD5.pm MD5.xs rfc1321.txt'
#
-my $EXPECT = <<EOT;
+my $EXPECT;
+
+if (ord "A" == 193) { # EBCDIC
+ $EXPECT = <<EOT;
23cafa2de11474f0df8f808cc588bcc9 Changes
3519f3d02c7c91158f732f0f00064657 README
0268931475ae2a2e843ff58504cfa3f0 MD5.pm
1be293491bba726810f8e87671ee0328 MD5.xs
754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
EOT
+} else {
+ $EXPECT = <<EOT;
+23cafa2de11474f0df8f808cc588bcc9 Changes
+3519f3d02c7c91158f732f0f00064657 README
+0268931475ae2a2e843ff58504cfa3f0 MD5.pm
+1be293491bba726810f8e87671ee0328 MD5.xs
+754b9db19f79dbc4992f7166eb0f37ce rfc1321.txt
+EOT
+}
if (!(-f "README") && -f "../README") {
chdir("..") or die "Can't chdir: $!";
@@ -23,13 +42,26 @@ my $testno = 0;
my $B64 = 1;
eval { require MIME::Base64; };
if ($@) {
- print $@;
- print "Will not test base64 methods\n";
+ print "# $@: Will not test base64 methods\n";
$B64 = 0;
}
for (split /^/, $EXPECT) {
my($md5hex, $file) = split ' ';
+ if ($ENV{PERL_CORE}) {
+ if ($file eq 'rfc1321.txt') { # Don't have it in core.
+ print "ok ", ++$testno, " # Skip: PERL_CORE\n";
+ next;
+ }
+ use File::Spec;
+ my @path = qw(ext Digest MD5);
+ my $path = File::Spec->updir;
+ while (@path) {
+ $path = File::Spec->catdir($path, shift @path);
+ }
+ $file = File::Spec->catfile($path, $file);
+ }
+# print "# file = $file\n";
my $md5bin = pack("H*", $md5hex);
my $md5b64;
if ($B64) {
@@ -37,14 +69,15 @@ for (split /^/, $EXPECT) {
chop($md5b64); chop($md5b64); # remove padding
}
my $failed;
+ my $got;
if (digest_file($file, 'digest') ne $md5bin) {
print "$file: Bad digest\n";
$failed++;
}
- if (digest_file($file, 'hexdigest') ne $md5hex) {
- print "$file: Bad hexdigest\n";
+ if (($got = digest_file($file, 'hexdigest')) ne $md5hex) {
+ print "$file: Bad hexdigest: got $got expected $md5hex\n";
$failed++;
}