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