blob: c5f9b60415c4d4d304426fe83a0e43aaba50aefe [file] [log] [blame]
Akronb2636cf2016-01-26 18:42:44 +01001use strict;
2use warnings;
3use Test::More;
4use File::Basename 'dirname';
5use File::Spec::Functions 'catdir';
6use Data::Dumper;
Akrone4c2e412016-01-28 15:10:50 +01007use KorAP::XML::Tokenizer;
8use KorAP::XML::Krill;
Akronb2636cf2016-01-26 18:42:44 +01009use utf8;
10
11my $path = catdir(dirname(__FILE__), 'TEST', 'BSP', 1);
12
Akrone4c2e412016-01-28 15:10:50 +010013ok(my $doc = KorAP::XML::Krill->new(
Akronb2636cf2016-01-26 18:42:44 +010014 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, 'TEST_BSP.1', 'ID-text');
23is($doc->doc_sigle, 'TEST_BSP', 'ID-doc');
24is($doc->corpus_sigle, 'TEST', 'ID-corpus');
25
Akrona8665782016-01-27 21:47:57 +010026is($doc->title, 'Sommerüberraschung', 'title');
Akrona8665782016-01-27 21:47:57 +010027is($doc->author, 'TEST.BSP.Autoren.1', 'Author');
28is($doc->store('sgbrAuthorAgeClass'), 'X', 'AgeClass');
Akron15e6fa72016-02-04 15:02:20 +010029
Akrona8665782016-01-27 21:47:57 +010030is($doc->store('sgbrAuthorSex'), 'M', 'Sex');
31is($doc->store('sgbrKodex'), 'M', 'Kodex');
32
33is($doc->doc_title, 'Beispielkorpus', 'Doc: title');
34is($doc->doc_sub_title, 'Subkorpus Beispieltext', 'Doc: subtitle');
35
36is($doc->language, 'de', 'Language');
37
38ok(!$doc->publisher, 'Publisher');
39ok(!$doc->editor, 'Editor');
40ok(!$doc->text_type, 'Text Type');
41ok(!$doc->text_type_art, 'Text Type Art');
42ok(!$doc->text_type_ref, 'Text Type Ref');
43ok(!$doc->text_column, 'Text Column');
44ok(!$doc->text_domain, 'Text Domain');
45ok(!$doc->creation_date, 'Creation Date');
46ok(!$doc->license, 'License');
47ok(!$doc->pages, 'Pages');
48ok(!$doc->file_edition_statement, 'File Edition Statement');
49ok(!$doc->bibl_edition_statement, 'Bibl Edition Statement');
50ok(!$doc->reference, 'Reference');
51
52ok(!$doc->doc_editor, 'Doc: editor');
53ok(!$doc->doc_author, 'Doc: author');
54
55ok(!$doc->corpus_title, 'Corpus: title');
56ok(!$doc->corpus_sub_title, 'Corpus: subtitle');
57ok(!$doc->corpus_editor, 'Corpus: editor');
58ok(!$doc->corpus_author, 'Corpus: author');
Akronb2636cf2016-01-26 18:42:44 +010059
Akron12ef05b2016-01-31 23:58:53 +010060my $hash = $doc->to_hash;
61is($hash->{title}, 'Sommerüberraschung', 'Corpus title');
62is($hash->{store}->{sgbrAuthorSex}, 'M', 'store');
63
Akron15e6fa72016-02-04 15:02:20 +010064# Sgbr specific keywords
65is($doc->keywords_string, 'sgbrAuthorAgeClass:X sgbrAuthorSex:M sgbrKodex:M');
66
Akronfd0707e2016-02-11 22:13:36 +010067
Akronb2636cf2016-01-26 18:42:44 +010068done_testing;
Akrona8665782016-01-27 21:47:57 +010069
70
71__END__