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; |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 5 | use JSON::XS; |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 6 | use Test::More; |
| 7 | use Scalar::Util qw/weaken/; |
| 8 | use Data::Dumper; |
Akron | 151676d | 2016-03-14 20:12:14 +0100 | [diff] [blame] | 9 | use lib 't/annotation'; |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 10 | use TestInit; |
| 11 | use File::Basename 'dirname'; |
| 12 | use File::Spec::Functions 'catdir'; |
| 13 | |
| 14 | |
| 15 | my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001'); |
| 16 | |
Akron | e4c2e41 | 2016-01-28 15:10:50 +0100 | [diff] [blame] | 17 | ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 18 | ok($doc->parse, 'Parse document'); |
Nils Diewald | b3e9ccd | 2016-10-24 15:16:52 +0200 | [diff] [blame] | 19 | like($doc->path, qr!\Q$path\E/!, 'Path'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 20 | |
| 21 | # Metdata |
Akron | 1cd5b87 | 2016-03-22 00:23:46 +0100 | [diff] [blame] | 22 | is($doc->text_sigle, 'Corpus/Doc/0001', 'ID-text'); |
| 23 | is($doc->doc_sigle, 'Corpus/Doc', 'ID-doc'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 24 | is($doc->corpus_sigle, 'Corpus', 'ID-corpus'); |
| 25 | |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 26 | my $meta = $doc->meta; |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 27 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 28 | is($meta->{T_title}, 'Beispiel Text', 'title'); |
| 29 | is($meta->{T_sub_title}, 'Beispiel Text Untertitel', 'title'); |
| 30 | is($meta->{D_pub_date}, '20010402', 'Publication date'); |
| 31 | is($meta->{S_pub_place}, 'Mannheim', 'Publication place'); |
| 32 | is($meta->{T_author}, 'Mustermann, Max', 'Author'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 33 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 34 | is($meta->{A_publisher}, 'Artificial articles Inc.', 'Publisher'); |
| 35 | is($meta->{A_editor}, 'Monika Mustermann', 'Editor'); |
| 36 | is($meta->{S_text_type}, 'Zeitung: Tageszeitung', 'Text Type'); |
| 37 | is($meta->{S_text_type_art}, 'Bericht', 'Text Type Art'); |
| 38 | is($meta->{S_text_type_ref}, 'Aphorismen', 'Text Type Ref'); |
| 39 | ok(!$meta->{S_text_column}, 'Text Column'); |
| 40 | ok(!$meta->{S_text_domain}, 'Text Domain'); |
| 41 | is($meta->{D_creation_date}, '19990601', 'Creation Date'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 42 | ok(!$meta->{license}, 'License'); |
| 43 | ok(!$meta->{pages}, 'Pages'); |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 44 | ok(!$meta->{A_file_edition_statement}, 'File Edition Statement'); |
| 45 | ok(!$meta->{A_bibl_edition_statement}, 'Bibl Edition Statement'); |
| 46 | ok(!$meta->{A_reference}, 'Reference'); |
| 47 | is($meta->{S_language}, 'de', 'Language'); |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 48 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 49 | is($meta->{T_doc_title}, 'Beispiel Dokument', 'Doc: title'); |
| 50 | ok(!$meta->{T_doc_sub_title}, 'Doc: subtitle'); |
| 51 | ok(!$meta->{A_doc_editor}, 'Doc: editor'); |
| 52 | ok(!$meta->{T_doc_author}, 'Doc: author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 53 | |
Akron | 5eb3aa0 | 2019-01-25 18:30:47 +0100 | [diff] [blame^] | 54 | is($meta->{T_corpus_title}, 'Werke von Beispiel', 'Corpus: title'); |
| 55 | ok(!$meta->{T_corpus_sub_title}, 'Corpus: subtitle'); |
| 56 | is($meta->{A_corpus_editor}, 'Mustermann, Monika', 'Corpus: editor'); |
| 57 | is($meta->{T_corpus_author}, 'Mustermann, Max', 'Corpus: author'); |
Akron | 35db6e3 | 2016-03-17 22:42:22 +0100 | [diff] [blame] | 58 | |
Akron | a866578 | 2016-01-27 21:47:57 +0100 | [diff] [blame] | 59 | |
| 60 | done_testing; |
| 61 | |
| 62 | __END__ |