"Fossies" - the Fresh Open Source Software Archive

Member "Digest-SHA1-2.13/t/bits.t" (6 Mar 2009, 709 Bytes) of package /linux/privat/old/Digest-SHA1-2.13.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!perl -w
    2 
    3 BEGIN {
    4     if ($] < 5.005) {
    5 	# Test module can't be expected to be available
    6 	# and I ended up with seg faults when trying to
    7 	# load it with eval { require Test };
    8 	print "1..0\n";
    9 	exit;
   10     }
   11 }
   12 
   13 use Test qw(plan ok);
   14 plan tests => 2;
   15 
   16 use Digest::SHA1;
   17 
   18 my $sha1 = Digest::SHA1->new;
   19 
   20 if ($Digest::base::VERSION && $Digest::base::VERSION) {
   21     $sha1->add_bits("01111111");
   22     ok($sha1->hexdigest, "23833462f55515a900e016db2eb943fb474c19f6");
   23     eval {
   24 	$sha1->add_bits("0111");
   25     };
   26     ok($@ =~ /must be multiple of 8/);
   27 }
   28 else {
   29     print "# No Digest::base\n";
   30     eval {
   31 	$sha1->add_bits("foo");
   32     };
   33     ok($@ =~ /^Can\'t locate Digest\/base\.pm in \@INC/);
   34     ok(1);  # dummy
   35 }
   36