blob: beaf2480854e8eb40df7adb35659766c41dd0377 [file] [log] [blame]
Akronef8544f2016-01-16 14:51:07 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
6use lib 't/index';
7use TestInit;
8use Scalar::Util qw/weaken/;
9use Data::Dumper;
10
11use_ok('KorAP::Document');
12
13ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
14
15ok($tokens->add('DeReKo', 'Structure'), 'Add Structure');
16
17my $data = $tokens->to_data->{data};
18
19like($data->{foundries}, qr!dereko/structure!, 'data');
20like($data->{layerInfos}, qr!dereko/s=spans!, 'data');
21
22# Empty element (from 0 to 0) on level 1, with TUI 2
23is($data->{stream}->[0]->[1],
Akron69a4a2f2016-01-17 12:55:50 +010024 '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>0<b>1<s>2',
Akronef8544f2016-01-16 14:51:07 +010025 'Empty element');
26
27# Attributes:
28is($data->{stream}->[0]->[10],
29 '@:dereko/s:version:1.1$<b>17<s>2',
30 'Attribute of idsHeader');
31
32is($data->{stream}->[0]->[11],
33 '@:dereko/s:TEIform:teiHeader$<b>17<s>2',
34 'Attribute of idsHeader');
35
36is($data->{stream}->[0]->[12],
37 '@:dereko/s:status:new$<b>17<s>2',
38 'Attribute of idsHeader');
39
40is($data->{stream}->[0]->[13],
41 '@:dereko/s:type:text$<b>17<s>2',
42 'Attribute of idsHeader');
43
44is($data->{stream}->[0]->[14],
45 '@:dereko/s:pattern:text$<b>17<s>2',
46 'Attribute of idsHeader');
47
48
Akron69a4a2f2016-01-17 12:55:50 +010049is($data->{stream}->[4]->[1],
50 '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1',
51 'Sentence span');
52
53is($data->{stream}->[4]->[2],
54 '@:dereko/s:broken:no$<b>17<s>1<i>6',
55 'Attribute of sentence span');
56
57is($data->{stream}->[6]->[0],
58 '<>:dereko/s:pb$<b>65<i>42<i>42<i>6<b>6<s>1',
59 'Pagebreak element');
Akronef8544f2016-01-16 14:51:07 +010060
61done_testing;
62
63__END__