huge pile of pod updates
[scpubgit/stemmatology.git] / t / stemma.t
index 6f3e7db..23fd8d9 100644 (file)
@@ -5,7 +5,7 @@ use File::Which;
 use Test::More;
 use lib 'lib';
 use Text::Tradition;
-use Text::Tradition::StemmaUtil qw/ phylip_pars_input /;
+use Text::Tradition::StemmaUtil;
 use XML::LibXML;
 use XML::LibXML::XPathContext;
 
@@ -23,36 +23,30 @@ $c->add_relationship( 'n9', 'n23', { 'type' => 'spelling' } );
 $c->add_relationship( 'n8', 'n13', { 'type' => 'spelling' } );
 $c->calculate_ranks();
 
-my $stemma = $tradition->add_stemma( 't/data/simple.dot' );
+my $stemma = $tradition->add_stemma( dotfile => 't/data/simple.dot' );
 
 # Test for object creation
 ok( $stemma->isa( 'Text::Tradition::Stemma' ), 'Got the right sort of object' );
 is( $stemma->graph, '1-2,1-A,2-B,2-C', "Got the correct graph" );
 
 # Test for character matrix creation
-my $m = phylip_pars_input( $c->make_alignment_table() );
+my $m = Text::Tradition::StemmaUtil::_make_character_matrix( $c->make_alignment_table() );
  ## check number of rows
-my $expected = "\t3\t18\n";
-$expected .= 'A         AAAAAAAXAAAAAAAAAA
-B         AXXXAAAAAABABAABAA
-C         AXXXAAAAABAAAAAXBB';
-$expected .= "\n";
-is( $m, $expected, "Got the right pars input" );
-# is( scalar @$m, 3, "Found three witnesses in char matrix" );
-#  ## check number of columns
-# is( scalar( @{$m->[0]} ), 19, "Found 18 rows plus sigla in char matrix" );
-#  ## check matrix
-# my %expected = (
-#      'A' => 'AAAAAAAXAAAAAAAAAA',
-#      'B' => 'AXXXAAAAAABABAABAA',
-#      'C' => 'AXXXAAAAABAAAAAXBB',
-#      );
-# my @wits = map { shift @$_; } @$m;
-# map { s/\s+//g } @wits;
-# foreach my $i ( 0 .. $#wits ) {
-#      my $w = $wits[$i];
-#      is( join( '', @{$m->[$i]} ), $expected{$w}, "Row for witness $w is correct" );
-# }
+is( scalar @$m, 3, "Found three witnesses in char matrix" );
+ ## check number of columns
+is( scalar( @{$m->[0]} ), 19, "Found 18 rows plus sigla in char matrix" );
+ ## check matrix
+my %expected = (
+       'A' => 'AAAAAAAXAAAAAAAAAA',
+       'B' => 'AXXXAAAAAABABAABAA',
+       'C' => 'AXXXAAAAABAAAAAXBB',
+       );
+my @wits = map { shift @$_; } @$m;
+map { s/\s+//g } @wits;
+foreach my $i ( 0 .. $#wits ) {
+       my $w = $wits[$i];
+       is( join( '', @{$m->[$i]} ), $expected{$w}, "Row for witness $w is correct" );
+}
 
 # Test that pars runs
 SKIP: {