remove some debugging statements
[scpubgit/stemmatology.git] / t / lexeme_serialize.t
CommitLineData
70745e70 1use lib 'lib';
2use strict;
3use warnings;
4use Test::More;
5use Text::Tradition;
6
7eval "use Flemm";
8plan skip_all => "Flemm 3.1 required" if $@;
9
10binmode( STDOUT, ':utf8' );
11binmode( STDERR, ':utf8' );
12
13my $tf = Text::Tradition->new(
14 'input' => 'Self',
15 'file' => 't/data/besoin.xml',
16 'language' => 'French' );
17
18$tf->lemmatize();
19my $graphmlstr = $tf->collation->as_graphml;
20like( $graphmlstr, qr/graphml xmlns/,
21 "Serialized tradition after lemmatization" );
22
23my $tf2 = Text::Tradition->new(
24 input => 'Self',
25 string => $graphmlstr,
26 language => 'French' );
27
28is( ref $tf2, 'Text::Tradition', "Re-parsed tradition with lemmatization" );
29is( $tf->name, $tf2->name, "Traditions have same name" );
30foreach my $r ( $tf->collation->readings ) {
31 my $r2 = $tf2->collation->reading( $r->id );
32 is( ref $r2, 'Text::Tradition::Collation::Reading',
33 "Reading $r exists in new tradition" );
34 if( $r2 ) {
35 is( scalar $r->lexemes, scalar $r2->lexemes,
36 "Same number of lexemes in new tradition for $r" );
37 }
38}
39
6ba69acd 40# Test a snippet of tradition with possibly-problematic saved lexemes
41my $tf3 = Text::Tradition->new(
42 'input' => 'Self',
43 'file' => 't/data/lexformat.xml' );
44is( ref $tf3, 'Text::Tradition',
45 "Successfully parsed tradition with incomplete lexemes" );
46
70745e70 47done_testing();