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