Frost
view release on metacpan or search on metacpan
t/000_moose_recipes/basics-recipe10.t view on Meta::CPAN
is(
$child->eye_color(),
$expected_color,
'mother '
. $mother->eye_color()
. ' + father '
. $father->eye_color()
. ' = child '
. $expected_color,
);
}
#DEBUG Dumper $GENE_POOL;
$GENE_POOL->close; # and save
# Reload...
foreach my $id (sort keys %$PERSONS ) {
my $person = Human->new(
id => $id,
asylum => $GENE_POOL
);
is(
$person->eye_color(),
$PERSONS->{$id}->{expected_color},
'gene combination '
. join( ',', @{$PERSONS->{$id}->{set}} )
. ' produces '
. $PERSONS->{$id}->{expected_color}
. ' eye color'
. ' (reloaded)',
);
}
#DEBUG Dumper $GENE_POOL;
foreach my $id (sort keys %$CHILDS ) {
my $child = Human->new(
id => $id,
asylum => $GENE_POOL
);
is(
$child->eye_color(),
$CHILDS->{$id}->{expected_color},
'mother '
. $CHILDS->{$id}->{mother_eye_color}
. ' + father '
. $CHILDS->{$id}->{father_eye_color}
. ' = child '
. $CHILDS->{$id}->{expected_color}
. ' (reloaded)',
);
}
# Hmm, not sure how to test for random selection of genes since
# I could theoretically run an infinite number of iterations and
# never find proof that a child has inherited a particular gene.
# AUTHOR: Aran Clary Deltac <bluefeet@cpan.org>
# Maybe there is another way to implent this, but for no we have
# to use a global $GENE_POOL = Frost::Asylum :-(
#
# Ernesto
done_testing;
( run in 2.305 seconds using v1.01-cache-2.11-cpan-800906f7e73 )