blob: 7cae3c560ff4ee6ce77c42849f01669cb1adcf47 [file] [log] [blame]
Akrona98a14c2016-02-12 16:28:39 +01001use strict;
2use warnings;
3use Test::More;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
6use Data::Dumper;
7use KorAP::XML::Tokenizer;
8use KorAP::XML::Krill;
9use utf8;
10
11my $path = catdir(dirname(__FILE__), 'PRO-DUD', 'BSP-2013-01', 32);
12
13ok(my $doc = KorAP::XML::Krill->new(
14 path => $path . '/'
15), 'Create Document');
16
17ok($doc->parse, 'Parse document');
18
19like($doc->path, qr!$path/!, 'Path');
20
21# Metdata
22is($doc->text_sigle, 'PRO-DUD_BSP-2013-01.32', 'ID-text');
23
24is($doc->doc_sigle, 'PRO-DUD_BSP-2013-01', 'ID-doc');
25is($doc->corpus_sigle, 'PRO-DUD', 'ID-corpus');
26
27is($doc->title, 'Nur Platt, kein Deutsch', 'title');
28ok(!$doc->sub_title, 'no subtitle');
29
30is($doc->publisher, 'Dorfblatt GmbH', 'Publisher');
31is($doc->pub_date, '20130126');
Akron8c84aa52016-02-13 21:26:54 +010032is($doc->store('sgbrDate'), '2013-01-26');
Akrona98a14c2016-02-12 16:28:39 +010033is($doc->pub_place, 'Stadtingen');
34
35is($doc->doc_title, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title');
36is($doc->doc_sub_title, 'Subkorpus Ortsblatt, Jahrgang 2013, Monat Januar', 'Doc Sub title');
37
38is($doc->store('funder'), 'Bundesministerium für Bildung und Forschung', 'Funder');
39
40is($doc->author, 'unbekannt', 'Author');
41ok(!$doc->store('sgbrAuthorSex'), 'No Sex');
42is($doc->store('sgbrKodex'), 'T', '');
43
44is($doc->keywords_string, 'sgbrKodex:T');
45
46is($doc->language, 'de', 'Language');
47
48ok(!$doc->editor, 'Editor');
49
50ok(!$doc->text_type, 'Text Type');
51ok(!$doc->text_type_art, 'Text Type Art');
52ok(!$doc->text_type_ref, 'Text Type Ref');
53ok(!$doc->text_column, 'Text Column');
54ok(!$doc->text_domain, 'Text Domain');
55ok(!$doc->creation_date, 'Creation Date');
56ok(!$doc->license, 'License');
57ok(!$doc->pages, 'Pages');
58ok(!$doc->file_edition_statement, 'File Edition Statement');
59ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
60ok(!$doc->reference, 'Reference');
61
62
63ok(!$doc->doc_editor, 'Doc: editor');
64ok(!$doc->doc_author, 'Doc: author');
65
66ok(!$doc->corpus_title, 'Corpus: title');
67ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
68ok(!$doc->corpus_editor, 'Corpus: editor');
69ok(!$doc->corpus_author, 'Corpus: author');
70
71my $hash = $doc->to_hash;
72is($hash->{title}, 'Nur Platt, kein Deutsch', 'Corpus title');
73is($hash->{store}->{sgbrKodex}, 'T', 'store');
74
75
76done_testing;
77
78
79__END__