blob: f89c934978ae9ff8f78f5611439a3e8327c63e29 [file] [log] [blame]
Akrona8665782016-01-27 21:47:57 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
Akron35db6e32016-03-17 22:42:22 +01005use JSON::XS;
Akrona8665782016-01-27 21:47:57 +01006use Test::More;
7use Scalar::Util qw/weaken/;
8use Data::Dumper;
Akron151676d2016-03-14 20:12:14 +01009use lib 't/annotation';
Akrona8665782016-01-27 21:47:57 +010010use TestInit;
11use File::Basename 'dirname';
12use File::Spec::Functions 'catdir';
13
14
15my $path = catdir(dirname(__FILE__), 'corpus', 'doc', '0001');
16
Akrone4c2e412016-01-28 15:10:50 +010017ok(my $doc = KorAP::XML::Krill->new( path => $path . '/' ), 'Load Korap::Document');
Akrona8665782016-01-27 21:47:57 +010018ok($doc->parse, 'Parse document');
19like($doc->path, qr!$path/!, 'Path');
20
21# Metdata
22is($doc->text_sigle, 'Corpus_Doc.0001', 'ID-text');
23is($doc->doc_sigle, 'Corpus_Doc', 'ID-doc');
24is($doc->corpus_sigle, 'Corpus', 'ID-corpus');
25
Akron35db6e32016-03-17 22:42:22 +010026my $meta = $doc->meta;
Akrona8665782016-01-27 21:47:57 +010027
Akron35db6e32016-03-17 22:42:22 +010028is($meta->{title}, 'Beispiel Text', 'title');
29is($meta->{sub_title}, 'Beispiel Text Untertitel', 'title');
30is($meta->{pub_date}, '20010402', 'Publication date');
31is($meta->{pub_place}, 'Mannheim', 'Publication place');
32is($meta->{author}, 'Mustermann, Max', 'Author');
Akrona8665782016-01-27 21:47:57 +010033
Akron35db6e32016-03-17 22:42:22 +010034is($meta->{publisher}, 'Artificial articles Inc.', 'Publisher');
35is($meta->{editor}, 'Monika Mustermann', 'Editor');
36is($meta->{text_type}, 'Zeitung: Tageszeitung', 'Text Type');
37is($meta->{text_type_art}, 'Bericht', 'Text Type Art');
38is($meta->{text_type_ref}, 'Aphorismen', 'Text Type Ref');
39ok(!$meta->{text_column}, 'Text Column');
40ok(!$meta->{text_domain}, 'Text Domain');
41is($meta->{creation_date}, '19990601', 'Creation Date');
42ok(!$meta->{license}, 'License');
43ok(!$meta->{pages}, 'Pages');
44ok(!$meta->{file_edition_statement}, 'File Edition Statement');
45ok(!$meta->{bibl_edition_statement}, 'Bibl Edition Statement');
46ok(!$meta->{reference}, 'Reference');
47is($meta->{language}, 'de', 'Language');
Akrona8665782016-01-27 21:47:57 +010048
Akron35db6e32016-03-17 22:42:22 +010049is($meta->{doc_title}, 'Beispiel Dokument', 'Doc: title');
50ok(!$meta->{doc_sub_title}, 'Doc: subtitle');
51ok(!$meta->{doc_editor}, 'Doc: editor');
52ok(!$meta->{doc_author}, 'Doc: author');
53
54is($meta->{corpus_title}, 'Werke von Beispiel', 'Corpus: title');
55ok(!$meta->{corpus_sub_title}, 'Corpus: subtitle');
56is($meta->{corpus_editor}, 'Mustermann, Monika', 'Corpus: editor');
57is($meta->{corpus_author}, 'Mustermann, Max', 'Corpus: author');
58
Akrona8665782016-01-27 21:47:57 +010059
60done_testing;
61
62__END__