blob: cd82130a8714d513ff7d34224188c567c7d3300b [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');
32is($doc->pub_place, 'Stadtingen');
33
34is($doc->doc_title, 'Korpus zur Beobachtung des Schreibgebrauchs im Deutschen', 'Doc title');
35is($doc->doc_sub_title, 'Subkorpus Ortsblatt, Jahrgang 2013, Monat Januar', 'Doc Sub title');
36
37is($doc->store('funder'), 'Bundesministerium für Bildung und Forschung', 'Funder');
38
39is($doc->author, 'unbekannt', 'Author');
40ok(!$doc->store('sgbrAuthorSex'), 'No Sex');
41is($doc->store('sgbrKodex'), 'T', '');
42
43is($doc->keywords_string, 'sgbrKodex:T');
44
45is($doc->language, 'de', 'Language');
46
47ok(!$doc->editor, 'Editor');
48
49ok(!$doc->text_type, 'Text Type');
50ok(!$doc->text_type_art, 'Text Type Art');
51ok(!$doc->text_type_ref, 'Text Type Ref');
52ok(!$doc->text_column, 'Text Column');
53ok(!$doc->text_domain, 'Text Domain');
54ok(!$doc->creation_date, 'Creation Date');
55ok(!$doc->license, 'License');
56ok(!$doc->pages, 'Pages');
57ok(!$doc->file_edition_statement, 'File Edition Statement');
58ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
59ok(!$doc->reference, 'Reference');
60
61
62ok(!$doc->doc_editor, 'Doc: editor');
63ok(!$doc->doc_author, 'Doc: author');
64
65ok(!$doc->corpus_title, 'Corpus: title');
66ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
67ok(!$doc->corpus_editor, 'Corpus: editor');
68ok(!$doc->corpus_author, 'Corpus: author');
69
70my $hash = $doc->to_hash;
71is($hash->{title}, 'Nur Platt, kein Deutsch', 'Corpus title');
72is($hash->{store}->{sgbrKodex}, 'T', 'store');
73
74
75done_testing;
76
77
78__END__