blob: 8f5f18af5cb0db48d400b7f979079ae6c4bbb1e5 [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
13ok($tokens->add('DeReKo', 'Structure'), 'Add Structure');
14
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
Akronee443f92016-02-25 23:56:49 +010041
42
Akronef8544f2016-01-16 14:51:07 +010043is($data->{stream}->[0]->[14],
44 '@:dereko/s:pattern:text$<b>17<s>2',
45 'Attribute of idsHeader');
46
Akron69a4a2f2016-01-17 12:55:50 +010047is($data->{stream}->[4]->[1],
48 '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1',
49 'Sentence span');
50
51is($data->{stream}->[4]->[2],
52 '@:dereko/s:broken:no$<b>17<s>1<i>6',
53 'Attribute of sentence span');
54
55is($data->{stream}->[6]->[0],
56 '<>:dereko/s:pb$<b>65<i>42<i>42<i>6<b>6<s>1',
57 'Pagebreak element');
Akronef8544f2016-01-16 14:51:07 +010058
59done_testing;
60
61__END__