4 use Test::More 'no_plan';
12 binmode STDOUT, ":utf8";
13 binmode STDERR, ":utf8";
14 eval { no warnings; binmode $DB::OUT, ":utf8"; };
16 my $tradition = 't/data/florilegium_graphml.xml';
17 my $t = Text::Tradition->new(
23 is( ref( $t ), 'Text::Tradition', "Parsed GraphML version 2" );
25 is( scalar $t->collation->readings, 319, "Collation has all readings" );
26 is( scalar $t->collation->paths, 376, "Collation has all paths" );
27 is( scalar $t->witnesses, 13, "Collation has all witnesses" );
30 # TODO add a relationship, write graphml, reparse it, check that the rel
32 $t->language('Greek');
33 $t->collation->add_relationship( 'w12', 'w13',
34 { 'type' => 'grammatical', 'scope' => 'global',
35 'annotation' => 'This is some note' } );
36 ok( $t->collation->get_relationship( 'w12', 'w13' ), "Relationship set" );
37 my $graphml_str = $t->collation->as_graphml;
39 my $newt = Text::Tradition->new( 'input' => 'Self', 'string' => $graphml_str );
40 is( ref( $newt ), 'Text::Tradition', "Parsed current GraphML version" );
42 is( scalar $newt->collation->readings, 319, "Collation has all readings" );
43 is( scalar $newt->collation->paths, 376, "Collation has all paths" );
44 is( scalar $newt->witnesses, 13, "Collation has all witnesses" );
45 is( scalar $newt->collation->relationships, 1, "Collation has added relationship" );
46 is( $newt->language, 'Greek', "Tradition has correct language setting" );
47 my $rel = $newt->collation->get_relationship( 'w12', 'w13' );
48 ok( $rel, "Found set relationship" );
49 is( $rel->annotation, 'This is some note', "Relationship has its properties" );