blob: 73b5be22388edf363080aeee0ca6f84a0c60a04f [file] [log] [blame]
Akronef8544f2016-01-16 14:51:07 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
Akrondcbee642020-10-30 18:01:43 +01006use KorAP::XML::Annotation::DeReKo::Structure;
Akron151676d2016-03-14 20:12:14 +01007use lib 't/annotation';
Akronef8544f2016-01-16 14:51:07 +01008use TestInit;
9use Scalar::Util qw/weaken/;
10use Data::Dumper;
11
Akronef8544f2016-01-16 14:51:07 +010012ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
13
Akron41ac10b2017-02-08 22:47:25 +010014ok($tokens->add('DeReKo', 'Structure', 'pagebreaks'), 'Add Structure');
Akronef8544f2016-01-16 14:51:07 +010015
16my $data = $tokens->to_data->{data};
17
18like($data->{foundries}, qr!dereko/structure!, 'data');
19like($data->{layerInfos}, qr!dereko/s=spans!, 'data');
20
21# Empty element (from 0 to 0) on level 1, with TUI 2
22is($data->{stream}->[0]->[1],
Akron69a4a2f2016-01-17 12:55:50 +010023 '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>0<b>1<s>2',
Akronef8544f2016-01-16 14:51:07 +010024 'Empty element');
25
Akronef8544f2016-01-16 14:51:07 +010026
Akrondec43122020-03-03 11:22:25 +010027is($data->{stream}->[0]->[5], '<>:base/s:t$<b>64<i>0<i>129<i>18<b>0', 'Text boundary');
Akronee443f92016-02-25 23:56:49 +010028
29# Attributes:
Akronef8544f2016-01-16 14:51:07 +010030is($data->{stream}->[0]->[11],
Akronee443f92016-02-25 23:56:49 +010031 '@:dereko/s:type:text$<b>17<s>2',
Akronef8544f2016-01-16 14:51:07 +010032 'Attribute of idsHeader');
33
34is($data->{stream}->[0]->[12],
35 '@:dereko/s:status:new$<b>17<s>2',
36 'Attribute of idsHeader');
37
38is($data->{stream}->[0]->[13],
Akronee443f92016-02-25 23:56:49 +010039 '@:dereko/s:version:1.1$<b>17<s>2',
Akronef8544f2016-01-16 14:51:07 +010040 'Attribute of idsHeader');
41
42is($data->{stream}->[0]->[14],
43 '@:dereko/s:pattern:text$<b>17<s>2',
44 'Attribute of idsHeader');
45
Akronb62d92a2020-03-01 16:32:00 +010046is($data->{stream}->[5]->[1],
Akron69a4a2f2016-01-17 12:55:50 +010047 '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1',
48 'Sentence span');
49
Akronb62d92a2020-03-01 16:32:00 +010050is($data->{stream}->[5]->[2],
Akron69a4a2f2016-01-17 12:55:50 +010051 '@:dereko/s:broken:no$<b>17<s>1<i>6',
52 'Attribute of sentence span');
53
Akronb62d92a2020-03-01 16:32:00 +010054is($data->{stream}->[7]->[0],
55 '<>:dereko/s:pb$<b>65<i>42<i>42<i>7<b>6<s>1',
Akron69a4a2f2016-01-17 12:55:50 +010056 'Pagebreak element');
Akronef8544f2016-01-16 14:51:07 +010057
Akronb62d92a2020-03-01 16:32:00 +010058is($data->{stream}->[7]->[-1],
Akron41ac10b2017-02-08 22:47:25 +010059 '~:base/s:pb$<i>2<i>42',
60 'Pagebreak element');
61
Akronef8544f2016-01-16 14:51:07 +010062done_testing;
63
64__END__