blob: 55693692d924884306dd6668738f3f3f04b1440e [file] [log] [blame]
Akronef8544f2016-01-16 14:51:07 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
Akron151676d2016-03-14 20:12:14 +01006use lib 't/annotation';
Akronef8544f2016-01-16 14:51:07 +01007use TestInit;
8use Scalar::Util qw/weaken/;
9use Data::Dumper;
10
Akronef8544f2016-01-16 14:51:07 +010011ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
12
Akron41ac10b2017-02-08 22:47:25 +010013ok($tokens->add('DeReKo', 'Structure', 'pagebreaks'), 'Add Structure');
Akronef8544f2016-01-16 14:51:07 +010014
15my $data = $tokens->to_data->{data};
16
17like($data->{foundries}, qr!dereko/structure!, 'data');
18like($data->{layerInfos}, qr!dereko/s=spans!, 'data');
19
20# Empty element (from 0 to 0) on level 1, with TUI 2
21is($data->{stream}->[0]->[1],
Akron69a4a2f2016-01-17 12:55:50 +010022 '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>0<b>1<s>2',
Akronef8544f2016-01-16 14:51:07 +010023 'Empty element');
24
Akronef8544f2016-01-16 14:51:07 +010025
Akronee443f92016-02-25 23:56:49 +010026is($data->{stream}->[0]->[5], '<>:base/s:t$<b>64<i>0<i>129<i>17<b>0', 'Text boundary');
27
28# Attributes:
Akronef8544f2016-01-16 14:51:07 +010029is($data->{stream}->[0]->[11],
Akronee443f92016-02-25 23:56:49 +010030 '@:dereko/s:type:text$<b>17<s>2',
Akronef8544f2016-01-16 14:51:07 +010031 'Attribute of idsHeader');
32
33is($data->{stream}->[0]->[12],
34 '@:dereko/s:status:new$<b>17<s>2',
35 'Attribute of idsHeader');
36
37is($data->{stream}->[0]->[13],
Akronee443f92016-02-25 23:56:49 +010038 '@:dereko/s:version:1.1$<b>17<s>2',
Akronef8544f2016-01-16 14:51:07 +010039 'Attribute of idsHeader');
40
41is($data->{stream}->[0]->[14],
42 '@:dereko/s:pattern:text$<b>17<s>2',
43 'Attribute of idsHeader');
44
Akron69a4a2f2016-01-17 12:55:50 +010045is($data->{stream}->[4]->[1],
46 '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1',
47 'Sentence span');
48
49is($data->{stream}->[4]->[2],
50 '@:dereko/s:broken:no$<b>17<s>1<i>6',
51 'Attribute of sentence span');
52
53is($data->{stream}->[6]->[0],
54 '<>:dereko/s:pb$<b>65<i>42<i>42<i>6<b>6<s>1',
55 'Pagebreak element');
Akronef8544f2016-01-16 14:51:07 +010056
Akron41ac10b2017-02-08 22:47:25 +010057is($data->{stream}->[6]->[-1],
58 '~:base/s:pb$<i>2<i>42',
59 'Pagebreak element');
60
Akronef8544f2016-01-16 14:51:07 +010061done_testing;
62
63__END__