blob: 4ecf608d77d27a630befff269826c385ae35cd13 [file] [log] [blame]
Akron601fc152016-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
Akron601fc152016-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],
Akronc078b9a2016-01-17 12:55:50 +010022 '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>0<b>1<s>2',
Akron601fc152016-01-16 14:51:07 +010023 'Empty element');
24
Akron601fc152016-01-16 14:51:07 +010025
Akronf6b20412016-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:
Akron601fc152016-01-16 14:51:07 +010029is($data->{stream}->[0]->[11],
Akronf6b20412016-02-25 23:56:49 +010030 '@:dereko/s:type:text$<b>17<s>2',
Akron601fc152016-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],
Akronf6b20412016-02-25 23:56:49 +010038 '@:dereko/s:version:1.1$<b>17<s>2',
Akron601fc152016-01-16 14:51:07 +010039 'Attribute of idsHeader');
40
Akronf6b20412016-02-25 23:56:49 +010041
42
Akron601fc152016-01-16 14:51:07 +010043is($data->{stream}->[0]->[14],
44 '@:dereko/s:pattern:text$<b>17<s>2',
45 'Attribute of idsHeader');
46
Akronc078b9a2016-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');
Akron601fc152016-01-16 14:51:07 +010058
59done_testing;
60
61__END__