blob: 713d8fd940355b426327e87a2f9ee6408113d7e2 [file] [log] [blame]
Akrona8665782016-01-27 21:47:57 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
6use Scalar::Util qw/weaken/;
7use Data::Dumper;
Akron151676d2016-03-14 20:12:14 +01008use lib 't/annotation';
Akrona8665782016-01-27 21:47:57 +01009use TestInit;
10use File::Basename 'dirname';
11use File::Spec::Functions 'catdir';
12
13
14my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001');
15
Akrone4c2e412016-01-28 15:10:50 +010016ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Akrona8665782016-01-27 21:47:57 +010017ok($doc->parse, 'Parse document');
18like($doc->path, qr!$path/!, 'Path');
19
20# Metdata
21is($doc->text_sigle, 'Corpus_Doc.0001', 'ID-text');
22is($doc->doc_sigle, 'Corpus_Doc', 'ID-doc');
23is($doc->corpus_sigle, 'Corpus', 'ID-corpus');
24
25is($doc->title, 'Beispiel Text', 'title');
26is($doc->sub_title, 'Beispiel Text Untertitel', 'title');
27is($doc->pub_date, '20010402', 'Publication date');
28is($doc->pub_place, 'Mannheim', 'Publication place');
29is($doc->author, 'Mustermann, Max', 'Author');
30
31is($doc->publisher, 'Artificial articles Inc.', 'Publisher');
32is($doc->editor, 'Monika Mustermann', 'Editor');
33is($doc->text_type, 'Zeitung: Tageszeitung', 'Text Type');
34is($doc->text_type_art, 'Bericht', 'Text Type Art');
35is($doc->text_type_ref, 'Aphorismen', 'Text Type Ref');
36ok(!$doc->text_column, 'Text Column');
37ok(!$doc->text_domain, 'Text Domain');
38is($doc->creation_date, '19990601', 'Creation Date');
39ok(!$doc->license, 'License');
40ok(!$doc->pages, 'Pages');
41ok(!$doc->file_edition_statement, 'File Edition Statement');
42ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
43ok(!$doc->reference, 'Reference');
44is($doc->language, 'de', 'Language');
45
46is($doc->doc_title, 'Beispiel Dokument', 'Doc: title');
47ok(!$doc->doc_sub_title, 'Doc: subtitle');
48ok(!$doc->doc_editor, 'Doc: editor');
49ok(!$doc->doc_author, 'Doc: author');
50
Akron9c0488f2016-01-28 14:17:15 +010051is($doc->corpus_title, 'Werke von Beispiel', 'Corpus: title');
Akrona8665782016-01-27 21:47:57 +010052ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
Akron9c0488f2016-01-28 14:17:15 +010053is($doc->corpus_editor, 'Mustermann, Monika', 'Corpus: editor');
54is($doc->corpus_author, 'Mustermann, Max', 'Corpus: author');
Akrona8665782016-01-27 21:47:57 +010055
56done_testing;
57
58__END__