4 use Test::More 'no_plan';
12 use Text::Tradition::Analysis qw/ run_analysis analyze_variant_location /;
14 my $datafile = 't/data/florilegium_tei_ps.xml';
15 my $tradition = Text::Tradition->new( 'input' => 'TEI',
17 'file' => $datafile );
18 my $s = $tradition->add_stemma( 'dotfile' => 't/data/florilegium.dot' );
19 is( ref( $s ), 'Text::Tradition::Stemma', "Added stemma to tradition" );
21 my %expected_genealogical = (
52 my $data = run_analysis( $tradition, calcdsn => 'dbi:SQLite:dbname=t/data/analysis.db' );
53 my $c = $tradition->collation;
54 foreach my $row ( @{$data->{'variants'}} ) {
55 # Account for rows that used to be "not useful"
56 unless( exists $expected_genealogical{$row->{'id'}} ) {
57 $expected_genealogical{$row->{'id'}} = 1;
59 my $gen_bool = $row->{'genealogical'} ? 1 : 0;
60 is( $gen_bool, $expected_genealogical{$row->{'id'}},
61 "Got correct genealogical flag for row " . $row->{'id'} );
62 # Check that we have the right row with the right groups
63 my $rank = $row->{'id'};
64 foreach my $rdghash ( @{$row->{'readings'}} ) {
65 # Skip 'readings' that aren't really
66 next unless $c->reading( $rdghash->{'readingid'} );
68 is( $c->reading( $rdghash->{'readingid'} )->rank, $rank,
69 "Got correct reading rank" );
71 my @realwits = sort $c->reading_witnesses( $rdghash->{'readingid'} );
72 my @sgrp = sort @{$rdghash->{'group'}};
73 is_deeply( \@sgrp, \@realwits, "Reading analyzed with correct groups" );
76 is( $data->{'variant_count'}, 58, "Got right total variant number" );
77 # TODO Make something meaningful of conflict count, maybe test other bits