Algorithm-Huffman

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

         Heap::Fibonacci  => 0,
         Heap::Elem       => 0,
         Tree::DAG_Node   => 0,
         List::Util       => 0,
         Carp             => 0,

         # Modules for the test script
         Test::More       => 0,
         Test::ManyParams => 0.04,
         Test::Exception  => 0,
         Data::Dumper     => 0,
         String::Random   => 0
    }, # e.g., Module::Name => 1.1
    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
      (AUTHOR     => 'Janek Schleicher <bigj@kamelfreund.de>') : ()),
);

README  view on Meta::CPAN

         Heap::Fibonacci  
         Heap::Elem       
         Tree::DAG_Node   
         List::Util
         Carp

         # Modules only for the test script
         Test::More       
         Test::ManyParams 
         Test::Exception  
         Data::Dumper     
         String::Random

COPYRIGHT AND LICENCE

Put the correct copyright and licence information here.

Copyright (C) 2002 Janek Schleicher

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

t/create_huffman_tree.t  view on Meta::CPAN


use strict;
use warnings;

use Algorithm::Huffman;

use Test::More tests => 13;
use Test::ManyParams;
use Test::Exception;

use Data::Dumper;

# some standard counted chars
# and the possibilities for a resulting encoding_hash
use constant STANDARD_CHAR_COUNTING => (
    [{a => 1, b => 1} =>              [{a => "0", b => "1"},
                                       {a => "1", b => "0"}]],
    [{a => 100, b => 1} =>            [{a => "0", b => "1"},
                                       {a => "1", b => "0"}]],
    [{a => 2, b => 1, c => 1} =>      [{a => "0", b => "10", c => "11"},
                                       {a => "0", b => "11", c => "10"},

t/encode_bitstring.t  view on Meta::CPAN

#!/usr/bin/perl

use Algorithm::Huffman;
use String::Random qw/random_string/;
use Test::More tests => 5 * 20 + 2;
use List::Util qw/max/;
use Data::Dumper;
use Test::Exception;

use constant MAX_COUNT            =>  1_000;
use constant MAX_SUBSTRING_LENGTH =>     10;
use constant HUFFMAN_ELEMENTS     =>  5_000;
use constant LONG_STRING_LENGTH   => 10_000;

sub myrand($) {
    return int( rand( int rand shift() ) + 1 );
}



( run in 0.922 second using v1.01-cache-2.11-cpan-a5abf4f5562 )