Algorithm-Evolutionary-Fitness

 view release on metacpan or  search on metacpan

t/0305-ecc.t  view on Meta::CPAN

use Algorithm::Evolutionary::Utils qw(random_bitstring);

use_ok( "Algorithm::Evolutionary::Fitness::ECC", "using Fitness::ECC OK" );

my $number_of_codewords = 16;
my $min_distance = 1;

my $ecc = new Algorithm::Evolutionary::Fitness::ECC( $number_of_codewords, $min_distance );
isa_ok( $ecc,  "Algorithm::Evolutionary::Fitness::ECC" );

throws_ok { new Algorithm::Evolutionary::Fitness::ECC()  } qr/codewords/, "No codewords";
throws_ok { new Algorithm::Evolutionary::Fitness::ECC(2,0)  } qr/istance/, "No distance";


my $string = random_bitstring(128);
ok( $ecc->ecc( $string ) > 0, "Seems to work" );
ok( $ecc->ecc( $string ) > 0, "Seems to work again" );
$string = random_bitstring(128);
ok( $ecc->ecc( $string ) > 0, "Keeps working" );
done_testing();



( run in 0.286 second using v1.01-cache-2.11-cpan-496ff517765 )