summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-02-11 14:15:33 +0000
committerfukachan <fukachan>2001-02-11 14:15:33 +0000
commit6e71682e97b949c80b8166e32a37288a46f801df (patch)
tree31b49d8070111ac4803d5704b7b3f3743409c9e0
parent57c3a4bff772ffbe1779d513b7502c560bc5414d (diff)
downloadfml8-6e71682e97b949c80b8166e32a37288a46f801df.tar.gz
fml8-6e71682e97b949c80b8166e32a37288a46f801df.tar.bz2
fml8-6e71682e97b949c80b8166e32a37288a46f801df.zip
enable self automatical check
-rw-r--r--regress/base/md5.pl36
1 files changed, 33 insertions, 3 deletions
diff --git a/regress/base/md5.pl b/regress/base/md5.pl
index 1759e899..97a1186f 100644
--- a/regress/base/md5.pl
+++ b/regress/base/md5.pl
@@ -9,12 +9,42 @@
# $FML$
#
-print STDERR "specify STDIN\n";
+$file = shift || '/etc/group';
-my $body; while (<>) { $body .= $_;}
+my $body;
+
+use FileHandle;
+my $fh = new FileHandle $file;
+while (<$fh>) { $body .= $_;}
+close($fh);
use FML::Checksum;
$p = new FML::Checksum;
-print $p->md5( \$body ), "\n";
+
+$internal = $p->md5( \$body );
+$external = program($file);
+
+print "FML::Checksum::md5 ... ";
+print (($internal eq $external) ? "ok" : "fail");
+print "\n";
exit 0;
+
+
+
+sub program
+{
+ my ($file) = @_;
+
+ use IO::Handle;
+ $fh = new IO::Handle;
+
+ open($fh, "md5 $file|");
+ while (<$fh>) {
+ chop;
+ (@x) = split(/\s*=\s*/);
+ }
+ close($fh);
+
+ return $x[1];
+}