diff --git a/t/Checker.pm b/t/Checker.pm deleted file mode 100644 index 11d24ec..0000000 --- a/t/Checker.pm +++ /dev/null @@ -1,34 +0,0 @@ -package Checker; - -use Exporter 'import'; - -@EXPORT = qw($CHECK okay_if note check filter_warnings); - -$Checker::OUTPUT = 1; -$Checker::CHECK = 0; - -# Only lets through warnings that originate outside our toolkit: -sub filter_warnings { - $SIG{'__WARN__'} = sub { - print STDERR $_[0] if ($_[0] !~ /^MIME:/); - }; -} - -sub okay_if { - print( ($_[0] ? "ok\n" : "not ok\n")) -} - -sub note { - print STDOUT " ## ", @_, "\n" if $OUTPUT; -} - -sub check { - ++$CHECK; - my ($ok, $note) = @_; - $note = ($note ? ": $note" : ''); - my $stat = ($ok ? 'OK ' : 'ERR'); - printf STDOUT " Test %2d$note\n", $CHECK if $OUTPUT; - print(($ok ? "ok $CHECK\n" : "not ok $CHECK\n")); -} -1; - diff --git a/t/comp2bin.t b/t/comp2bin.t index 0583627..7072c45 100644 --- a/t/comp2bin.t +++ b/t/comp2bin.t @@ -1,9 +1,11 @@ -use lib "./blib/lib", "./lib", "./t"; +use strict; +use warnings; + +use Test::More; -use Checker; use Convert::BinHex; -%TEST = ( +my %TEST = ( PIVOT_3 => { COMP => ["90 00 01 02 03 04 00", "90 00 03"], @@ -59,27 +61,18 @@ sub str2hex { #------------------------------------------------------------ # BEGIN #------------------------------------------------------------ -print "1..9\n"; -my $TESTKEY; -foreach $TESTKEY (sort keys %TEST) { +foreach my $TESTKEY (sort keys %TEST) { my $test = $TEST{$TESTKEY}; my @comps = map { str2hex($_) } @{$test->{COMP}}; my $bin = str2hex($test->{BIN}); - my $comp; my $rbin = ''; my $H2B = Convert::BinHex->hex2bin; - foreach $comp (@comps) { - $rbin .= $H2B->comp2bin_next($comp); + foreach my $comp (@comps) { + $rbin .= $H2B->comp2bin_next($comp); } - check(($rbin eq $bin), "test $TESTKEY"); + is($rbin, $bin, "test $TESTKEY"); } -1; - - - - - - +done_testing();