blob: 777d14d63c198a82365af10922e7fc765cb0c457 [file] [log] [blame]
Akron414ec952020-08-03 15:48:43 +02001use strict;
2use warnings;
3use utf8;
4use Test::More;
5use Benchmark ':hireswallclock';
6use Mojo::DOM;
7use Mojo::File;
8use Mojo::ByteStream 'b';
9use Data::Dumper;
10use File::Basename 'dirname';
11use File::Spec::Functions 'catdir';
12use lib 'lib', '../lib';
13
14use_ok('KorAP::XML::Krill');
15
16# ART
17my $path = catdir(dirname(__FILE__), 'corpus','artificial');
18ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
19#is($doc->path, $path . '/', 'Path');
20
21ok($doc = KorAP::XML::Krill->new( path => $path ), 'Load Korap::Document');
22#is($doc->path, $path . '/', 'Path');
23
24ok($doc->parse, 'Parse document');
25
26my $meta = $doc->meta;
27
28# Metdata
29is($meta->{T_title}, 'Artificial Title', 'title');
30is($meta->{T_sub_title}, 'Artificial Subtitle', 'subTitle');
31is($doc->text_sigle, 'ART/ABC/00001', 'ID');
32is($doc->corpus_sigle, 'ART', 'corpusID');
33is($meta->{D_pub_date}, '20010402', 'pubDate');
34is($meta->{S_pub_place}, 'Mannheim', 'pubPlace');
35is($meta->{S_pub_place_key}, 'DE', 'pubPlace key');
36is($meta->{K_text_class}->[0], 'freizeit-unterhaltung', 'TextClass');
37is($meta->{K_text_class}->[1], 'vereine-veranstaltungen', 'TextClass');
38ok(!$meta->{K_text_class}->[2], 'TextClass');
39#is($doc->author->[0], 'Ruru', 'author');
40#is($doc->author->[1], 'Jens.Ol', 'author');
41#is($doc->author->[2], 'Aglarech', 'author');
42is($meta->{T_author}, 'Ruru; Jens.Ol; Aglarech; u.a.', 'author');
43
44# Additional information
45is($meta->{A_editor}, 'Nils Diewald', 'Editor');
46is($meta->{A_publisher}, 'Artificial articles Inc.', 'Publisher');
47is($meta->{D_creation_date}, '19990601', 'Creation date');
48#is($doc->coll_title, 'Artificial articles', 'Collection title');
49#is($doc->coll_sub_title, 'Best of!', 'Collection subtitle');
50#is($doc->coll_editor, 'Nils Diewald', 'Collection editor');
51#is($doc->coll_author, 'Nils Diewald', 'Collection author');
52is($meta->{S_text_type}, 'Zeitung: Tageszeitung', 'No text_type');
53is($meta->{S_text_type_art}, 'Bericht', 'text_type art');
54
55done_testing;
56__END__
57