4 use Test::More 'no_plan';
11 use Text::Tradition::Collation;
14 use_ok( 'Text::Tradition::Stemma' );
16 # Placeholder collation to use in tests
17 my $c = Text::Tradition::Collation->new();
19 # Try to create a bad graph
21 open( $baddotfh, 't/data/besoin_bad.dot' ) or die "Could not open test dotfile";
23 my $stemma = Text::Tradition::Stemma->new( collation => $c, dot => $baddotfh );
24 ok( 0, "Created broken stemma from dotfile with syntax error" );
25 } catch( Text::Tradition::Error $e ) {
26 like( $e->message, qr/^Error trying to parse/, "Syntax error in dot threw exception" );
31 open( $dotfh, 't/data/florilegium.dot' ) or die "Could not open test dotfile";
32 binmode( $dotfh, ':utf8' );
33 my $stemma = Text::Tradition::Stemma->new( collation => $c, dot => $dotfh );
34 is( ref( $stemma ), 'Text::Tradition::Stemma', "Created stemma from good dotfile" );
35 is( scalar $stemma->witnesses, 13, "Found correct number of extant witnesses" );
36 is( scalar $stemma->hypotheticals, 8, "Found correct number of extant hypotheticals" );
37 my $found_unicode_sigil;
38 foreach my $h ( $stemma->hypotheticals ) {
39 $found_unicode_sigil = 1 if $h eq "\x{3b1}";
41 ok( $found_unicode_sigil, "Found a correctly encoded Unicode sigil" );