Commit | Line | Data |
7f52eac8 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use Test::More 'no_plan'; |
5 | $| = 1; |
6 | |
7 | |
8 | |
9 | # =begin testing |
10 | { |
11 | use Text::Tradition; |
12 | use Text::Tradition::Analysis qw/ run_analysis analyze_variant_location /; |
13 | |
14 | my $datafile = 't/data/florilegium_tei_ps.xml'; |
15 | my $tradition = Text::Tradition->new( 'input' => 'TEI', |
16 | 'name' => 'test0', |
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" ); |
20 | |
f00cefe8 |
21 | my %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 |
52 | my $data = run_analysis( $tradition ); |
f00cefe8 |
53 | foreach my $row ( @{$data->{'variants'}} ) { |
54 | is( $row->{'genealogical'}, $expected_genealogical{$row->{'id'}}, |
55 | "Got correct genealogical flag for row " . $row->{'id'} ); |
56 | } |
5be0cdeb |
57 | is( $data->{'conflict_count'}, 16, "Got right conflict count" ); |
58 | is( $data->{'variant_count'}, 28, "Got right total variant number" ); |
7f52eac8 |
59 | } |
60 | |
61 | |
62 | |
63 | |
64 | 1; |