/[Sack]/trunk/t/Sack-Digest.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/t/Sack-Digest.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (hide annotations)
Thu Sep 24 12:13:41 2009 UTC (14 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 821 byte(s)
check undigested hash
1 dpavlin 33 #!/usr/bin/perl
2    
3 dpavlin 43 use Test::More tests => 17;
4 dpavlin 36 use Data::Dump qw(dump);
5 dpavlin 33
6     use lib 'lib';
7    
8     BEGIN {
9     use_ok( 'Sack::Digest' );
10     }
11    
12 dpavlin 34 ok( Sack::Digest->clean, 'clean' );
13    
14 dpavlin 33 ok( my $o = Sack::Digest->open( 0 ), 'open' );
15    
16 dpavlin 34 foreach my $full ( 'foo', 'bar', 'baz' ) {
17 dpavlin 33
18 dpavlin 34 ok( my $nr = Sack::Digest->to_int( $full ), "to_int $full" );
19     ok( $nr =~ m/^\d+$/, 'int' );
20    
21     cmp_ok( Sack::Digest->from_int( $nr ), 'eq', $full, "from_int $nr" );
22    
23     }
24    
25     cmp_ok( Sack::Digest->from_int( 42 ), '==', 42, 'from_int missing' );
26    
27     ok( Sack::Digest->close, 'close' );
28 dpavlin 36
29     ok( Sack::Digest->open(0), 'open again' );
30    
31     my $out = {
32     "CR#+" => { 1=>1, 2=>1, 3=>1, 4=>1, 5=>1 }
33     };
34    
35     ok( my $full = Sack::Digest->undigest_out( $out ), 'undigest_out' );
36     diag dump $full;
37 dpavlin 43 is_deeply( $full, { "CR#+" => { 4 => 1, 5 => 1, bar => 1, baz => 1, foo => 1 } }, 'undigested' );
38 dpavlin 36

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26