summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorfukachan <fukachan>2006-01-24 11:33:04 +0000
committerfukachan <fukachan>2006-01-24 11:33:04 +0000
commitce8c5ca40671359c9f03d6e4652cebe1d60f4249 (patch)
tree5655b0eb872bfb58e32e5120b61a8a6eb6757be6 /regress
parentd96dd7a2bd45725497d0bcf48114dfa32a3143ad (diff)
downloadfml8-ce8c5ca40671359c9f03d6e4652cebe1d60f4249.tar.gz
fml8-ce8c5ca40671359c9f03d6e4652cebe1d60f4249.tar.bz2
fml8-ce8c5ca40671359c9f03d6e4652cebe1d60f4249.zip
overhaul.
based on FML::Test::Utils.
Diffstat (limited to 'regress')
-rwxr-xr-xregress/base/date2unixtime.pl27
-rwxr-xr-xregress/base/journaledfile.pl33
-rwxr-xr-xregress/base/lock.pl31
-rw-r--r--regress/base/md5.pl13
-rwxr-xr-xregress/base/mime.pl18
5 files changed, 72 insertions, 50 deletions
diff --git a/regress/base/date2unixtime.pl b/regress/base/date2unixtime.pl
index cdb4c42d..86b1bea7 100755
--- a/regress/base/date2unixtime.pl
+++ b/regress/base/date2unixtime.pl
@@ -1,6 +1,10 @@
#!/usr/bin/env perl
#
-# $FML: date2unixtime.pl,v 1.3 2002/04/18 14:18:07 fukachan Exp $
+# Copyright (C) 2002,2006 Ken'ichi Fukamachi
+# All rights reserved. This program is free software; you can
+# redistribute it and/or modify it under the same terms as Perl itself.
+#
+# $FML: date2unixtime.pl,v 1.4 2002/05/11 08:34:52 fukachan Exp $
#
use strict;
@@ -12,19 +16,20 @@ require 'ctime.pl';
my $t = time;
my $date = ctime( $t );
+$date =~ s/[\s\n]*$//;
-chop $date;
-
-my $tx = Mail::Message::Date::date_to_unixtime( $date );
+my $dp = new Mail::Message::Date;
+my $tx = $dp->date_to_unixtime( $date );
-print STDERR "Mail::Message::Date ";
-print STDERR "(date -> unixtime): $t => $date => $tx\n" if $debug;
+use FML::Test::Utils;
+my $tool = new FML::Test::Utils;
+$tool->set_title("Mail::Message::Date");
-if ($t == $tx) {
- print STDERR "ok\n";
-}
-else {
- print STDERR "fail\n";
+if ($debug) {
+ print STDERR "Mail::Message::Date ";
+ print STDERR "(date -> unixtime): $t => $date => $tx\n";
}
+$tool->diff($t, $tx);
+
exit 0;
diff --git a/regress/base/journaledfile.pl b/regress/base/journaledfile.pl
index 62c60f44..4848a5f0 100755
--- a/regress/base/journaledfile.pl
+++ b/regress/base/journaledfile.pl
@@ -1,6 +1,10 @@
#!/usr/bin/env perl
#
-# $FML: journaledfile.pl,v 1.4 2002/05/11 08:34:52 fukachan Exp $
+# Copyright (C) 2002,2006 Ken'ichi Fukamachi
+# All rights reserved. This program is free software; you can
+# redistribute it and/or modify it under the same terms as Perl itself.
+#
+# $FML: journaledfile.pl,v 1.5 2002/08/03 10:33:27 fukachan Exp $
#
use strict;
@@ -9,17 +13,19 @@ use Tie::JournaledFile;
$| = 1;
+use FML::Test::Utils;
+my $tool = new FML::Test::Utils;
+$tool->set_title("Tie::JournaledFile write");
+
#
# 1. read/write
#
-print "Tie::JournaledFile write ... ";
-
my $debug = defined $ENV{'debug'} ? 1 : 0;
my %db = ();
my $file = '/tmp/fml5/cache.txt';
my $buf = '';
my $key = "rudo$$";
-chop($buf = `date`);
+chomp($buf = `date`);
tie %db, 'Tie::JournaledFile', { file => $file };
$db{ $key } = $buf;
@@ -30,30 +36,19 @@ print " ", `ls -l $file` if $debug;
tie %db, 'Tie::JournaledFile', { file => $file };
print "verify written string ... " if $debug;
-if ($db{ $key } eq $buf) {
- print "ok\n";
-}
-else {
- print "fail\n";
- print " >", $db{ $key }, "<\n";
- print " >", $buf, "<\n";
-}
+$tool->diff($db{ $key }, $buf);
#
# 2. keys
#
-print "Tie::JournaledFile keys ... ";
+$tool->set_title("Tie::JournaledFile keys");
my @p = keys %db;
my $count_orig = ` awk '{print $1}' $file | sort | uniq | wc -l `;
+$count_orig =~ s/\s+//g;
my $count = $#p + 1;
-if ($count_orig == $count) {
- print "ok\n";
-}
-else {
- print "fail ($count_orig != $count)\n";
-}
+$tool->diff($count_orig, $count);
exit 0;
diff --git a/regress/base/lock.pl b/regress/base/lock.pl
index f8c531e2..f39296e2 100755
--- a/regress/base/lock.pl
+++ b/regress/base/lock.pl
@@ -1,34 +1,41 @@
#!/usr/bin/env perl
#
-# $FML: lock.pl,v 1.6 2002/04/18 14:18:07 fukachan Exp $
+# Copyright (C) 2002,2006 Ken'ichi Fukamachi
+# All rights reserved. This program is free software; you can
+# redistribute it and/or modify it under the same terms as Perl itself.
+#
+# $FML: lock.pl,v 1.7 2002/05/11 08:34:52 fukachan Exp $
#
use strict;
my $debug = defined $ENV{'debug'} ? 1 : 0;
-use File::SimpleLock;
-my $lockobj = new File::SimpleLock;
+my $map = "/tmp/fml8";
+
+use FML::Test::Utils;
+my $tool = new FML::Test::Utils;
+$tool->set_title("file lock");
-print STDERR "File::SimpleLock ";
+use IO::Adapter;
+my $io = new IO::Adapter $map;
+my $r = $io->lock( { file => $map } );
-my $r = $lockobj->lock( { file => '/tmp/fml5' });
if ($r) {
- print STDERR "lock ($$) ... ok\n";
+ $tool->print_ok();
}
else {
- print STDERR $lockobj->error, "\n";
+ $tool->print_error($io->error);
}
sleep 1;
-print STDERR "File::SimpleLock ";
-
-$r = $lockobj->unlock( { file => '/tmp/fml5' });
+$tool->set_title("file unlock");
+$r = $io->unlock( { file => '/tmp/fml5' });
if ($r) {
- print STDERR "unlock ... ok\n";
+ $tool->print_ok();
}
else {
- print STDERR $lockobj->error, "\n";
+ $tool->print_error($io->error);
}
exit 0;
diff --git a/regress/base/md5.pl b/regress/base/md5.pl
index 4fb8bc1c..abb97cb4 100644
--- a/regress/base/md5.pl
+++ b/regress/base/md5.pl
@@ -1,11 +1,11 @@
#!/usr/bin/env perl
#-*- perl -*-
#
-# Copyright (C) 2001,2002 Ken'ichi Fukamachi
+# Copyright (C) 2001,2002,2006 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: md5.pl,v 1.5 2001/12/23 03:01:27 fukachan Exp $
+# $FML: md5.pl,v 1.6 2002/04/18 14:18:07 fukachan Exp $
#
use strict;
@@ -15,6 +15,10 @@ my $debug = defined $ENV{'debug'} ? 1 : 0;
my $file = shift || '/etc/group';
my $body = '';
+use FML::Test::Utils;
+my $tool = new FML::Test::Utils;
+$tool->set_title("md5 checksum");
+
use FileHandle;
my $fh = new FileHandle $file;
while (<$fh>) { $body .= $_;}
@@ -26,9 +30,8 @@ my $p = new Mail::Message::Checksum;
my $internal = $p->md5( \$body );
my $external = program($file);
-print "Mail::Message::Checksum::md5 ... ";
-print (($internal eq $external) ? "ok" : "fail");
-print "\n";
+$tool->set_title("Mail::Message::Checksum::md5");
+$tool->diff($internal, $external);
exit 0;
diff --git a/regress/base/mime.pl b/regress/base/mime.pl
index 0af3e3ff..716508a2 100755
--- a/regress/base/mime.pl
+++ b/regress/base/mime.pl
@@ -1,6 +1,10 @@
#!/usr/bin/env perl
#
-# $FML: mime.pl,v 1.8 2002/04/18 14:18:07 fukachan Exp $
+# Copyright (C) 2002,2006 Ken'ichi Fukamachi
+# All rights reserved. This program is free software; you can
+# redistribute it and/or modify it under the same terms as Perl itself.
+#
+# $FML: mime.pl,v 1.9 2002/08/17 05:26:48 fukachan Exp $
#
use strict;
@@ -10,6 +14,10 @@ use MIME::QuotedPrint;
my $debug = defined $ENV{'debug'} ? 1 : 0;
+use FML::Test::Utils;
+my $tool = new FML::Test::Utils;
+$tool->set_title("mime");
+
use Mail::Message::Encode;
my $obj = new Mail::Message::Encode;
@@ -42,8 +50,12 @@ sub try_mime
$buf =~ s/\n/\n |/g;
print $buf, "\n" if $debug;
- print ($orig_str eq $out_str_b64 ? "base64 ... ok\n" : "fail\n");
- print ($orig_str eq $out_str_qp ? "qp ... ok\n" : "fail\n");
+
+ $tool->set_title("mime base64");
+ $tool->diff($orig_str, $out_str_b64);
+
+ $tool->set_title("mime qp");
+ $tool->diff($orig_str, $out_str_qp);
}