diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2006-07-14 02:10:27 +0300 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-07-13 20:18:59 +0000 |
commit | cf0d1c66a0d97cdcc6938d91401fa36b9b5a67ac (patch) | |
tree | 65674c4cd5d583a2c89833405ac421a19c1387be /lib/Digest | |
parent | 2f3efc978ada94e3718bd6f3a25b06cd1d13b6f8 (diff) | |
download | perl-cf0d1c66a0d97cdcc6938d91401fa36b9b5a67ac.tar.gz |
z/OS: CPAN-ized ext/ and lib/
Message-ID: <44B6A8B3.5070605@iki.fi>
p4raw-id: //depot/perl@28568
Diffstat (limited to 'lib/Digest')
-rw-r--r-- | lib/Digest/t/base.t | 18 | ||||
-rw-r--r-- | lib/Digest/t/file.t | 10 |
2 files changed, 21 insertions, 7 deletions
diff --git a/lib/Digest/t/base.t b/lib/Digest/t/base.t index c398346cac..b2614f79e0 100644 --- a/lib/Digest/t/base.t +++ b/lib/Digest/t/base.t @@ -32,17 +32,25 @@ plan tests => 12; my $ctx = LenDigest->new; ok($ctx->digest, "X0000"); -ok($ctx->hexdigest, "5830303030"); -ok($ctx->b64digest, "WDAwMDA"); + +my $EBCDIC = ord('A') == 193; + +if ($EBCDIC) { + ok($ctx->hexdigest, "e7f0f0f0f0"); + ok($ctx->b64digest, "5/Dw8PA"); +} else { + ok($ctx->hexdigest, "5830303030"); + ok($ctx->b64digest, "WDAwMDA"); +} $ctx->add("foo"); ok($ctx->digest, "f0003"); $ctx->add("foo"); -ok($ctx->hexdigest, "6630303033"); +ok($ctx->hexdigest, $EBCDIC ? "86f0f0f0f3" : "6630303033"); $ctx->add("foo"); -ok($ctx->b64digest, "ZjAwMDM"); +ok($ctx->b64digest, $EBCDIC ? "hvDw8PM" : "ZjAwMDM"); open(F, ">xxtest$$") || die; binmode(F); @@ -61,7 +69,7 @@ eval { }; ok($@ =~ /^Number of bits must be multiple of 8/); -$ctx->add_bits("01010101"); +$ctx->add_bits($EBCDIC ? "11100100" : "01010101"); ok($ctx->digest, "U0001"); eval { diff --git a/lib/Digest/t/file.t b/lib/Digest/t/file.t index 2184ac26f5..f431a385a5 100644 --- a/lib/Digest/t/file.t +++ b/lib/Digest/t/file.t @@ -37,8 +37,14 @@ print F "foo\0\n"; close(F) || die "Can't write '$file': $!"; ok(digest_file($file, "Foo"), "0005"); -ok(digest_file_hex($file, "Foo"), "30303035"); -ok(digest_file_base64($file, "Foo"), "MDAwNQ"); + +if (ord('A') == 193) { # EBCDIC. + ok(digest_file_hex($file, "Foo"), "f0f0f0f5"); + ok(digest_file_base64($file, "Foo"), "8PDw9Q"); +} else { + ok(digest_file_hex($file, "Foo"), "30303035"); + ok(digest_file_base64($file, "Foo"), "MDAwNQ"); +} unlink($file) || warn "Can't unlink '$file': $!"; |