fix Tabular parser to account for a.c. wits; more doc and tests
[scpubgit/stemmatology.git] / t / stemma.t
1 #!/usr/bin/perl
2
3 use strict; use warnings;
4 use Test::More;
5 use lib 'lib';
6 use Text::Tradition;
7 use Text::Tradition::Stemma;
8 use XML::LibXML;
9 use XML::LibXML::XPathContext;
10
11 my $datafile = 't/data/Collatex-16.xml'; #TODO need other test data
12
13 open( GRAPHFILE, $datafile ) or die "Could not open $datafile";
14 my @lines = <GRAPHFILE>;
15 close GRAPHFILE;
16 my $tradition = Text::Tradition->new( 'CollateX' => join( '', @lines ),
17                                       'linear' => 1 );
18 my $stemma = Text::Tradition::Stemma->new( 'tradition' => $tradition );
19
20 # Test for object creation
21 ok( $stemma->isa( 'Text::Tradition::Stemma' ), 'Got the right sort of object' );
22
23 # Test for character matrix creation
24 $stemma->make_character_matrix();
25  ## check number of rows
26  ## check number of columns
27
28 # Test that pars runs
29 my( $status, $tree ) = $stemma->run_pars();
30 ok( $status, "pars ran successfully" );
31 print STDERR "Error was $tree\n" unless $status;
32
33 # Test that we get a tree
34
35 # Test that the tree has all our witnesses