works now apart from the perl solver fallback
[scpubgit/stemmatology.git] / t / text_tradition_analysis.t
CommitLineData
7f52eac8 1#!/usr/bin/perl -w
2
3use strict;
4use Test::More 'no_plan';
5$| = 1;
6
7
8
9# =begin testing
10{
11use Text::Tradition;
12use Text::Tradition::Analysis qw/ run_analysis analyze_variant_location /;
13
14my $datafile = 't/data/florilegium_tei_ps.xml';
15my $tradition = Text::Tradition->new( 'input' => 'TEI',
16 'name' => 'test0',
17 'file' => $datafile );
18my $s = $tradition->add_stemma( 'dotfile' => 't/data/florilegium.dot' );
19is( ref( $s ), 'Text::Tradition::Stemma', "Added stemma to tradition" );
20
f00cefe8 21my %expected_genealogical = (
22 1 => '',
23 2 => 1,
24 3 => '',
25 5 => '',
26 7 => '',
27 8 => '',
28 10 => '',
29 13 => 1,
30 33 => '',
31 34 => '',
32 37 => '',
33 60 => '',
34 81 => 1,
35 84 => '',
36 87 => '',
37 101 => '',
38 102 => '',
39 122 => 1,
40 157 => '',
41 166 => 1,
42 169 => 1,
43 200 => 1,
44 216 => 1,
45 217 => 1,
46 219 => 1,
47 241 => 1,
48 242 => 1,
49 243 => 1,
50);
51
7f52eac8 52my $data = run_analysis( $tradition );
f00cefe8 53foreach my $row ( @{$data->{'variants'}} ) {
54 is( $row->{'genealogical'}, $expected_genealogical{$row->{'id'}},
55 "Got correct genealogical flag for row " . $row->{'id'} );
56}
5be0cdeb 57is( $data->{'conflict_count'}, 16, "Got right conflict count" );
58is( $data->{'variant_count'}, 28, "Got right total variant number" );
7f52eac8 59}
60
61
62
63
641;