start documenting and testing
[scpubgit/stemmatology.git] / t / stemma.t
CommitLineData
6f4946fb 1#!/usr/bin/perl
2
3use strict; use warnings;
4use Test::More;
5use lib 'lib';
6use Text::Tradition;
7use Text::Tradition::Stemma;
8use XML::LibXML;
9use XML::LibXML::XPathContext;
10
11my $datafile = 't/data/Collatex-16.xml'; #TODO need other test data
12
13open( GRAPHFILE, $datafile ) or die "Could not open $datafile";
14my @lines = <GRAPHFILE>;
15close GRAPHFILE;
16my $tradition = Text::Tradition->new( 'CollateX' => join( '', @lines ),
17 'linear' => 1 );
18my $stemma = Text::Tradition::Stemma->new( 'tradition' => $tradition );
19
20# Test for object creation
21ok( $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
29my( $status, $tree ) = $stemma->run_pars();
30ok( $status, "pars ran successfully" );
31print 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