blob: f6f6f5ee49f1728e292949c743f084f7cdca5162 [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
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
25# Attributes:
26is($data->{stream}->[0]->[10],
27 '@:dereko/s:version:1.1$<b>17<s>2',
28 'Attribute of idsHeader');
29
30is($data->{stream}->[0]->[11],
31 '@:dereko/s:TEIform:teiHeader$<b>17<s>2',
32 '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],
39 '@:dereko/s:type:text$<b>17<s>2',
40 'Attribute of idsHeader');
41
42is($data->{stream}->[0]->[14],
43 '@:dereko/s:pattern:text$<b>17<s>2',
44 'Attribute of idsHeader');
45
Akron69a4a2f2016-01-17 12:55:50 +010046is($data->{stream}->[4]->[1],
47 '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1',
48 'Sentence span');
49
50is($data->{stream}->[4]->[2],
51 '@:dereko/s:broken:no$<b>17<s>1<i>6',
52 'Attribute of sentence span');
53
54is($data->{stream}->[6]->[0],
55 '<>:dereko/s:pb$<b>65<i>42<i>42<i>6<b>6<s>1',
56 'Pagebreak element');
Akronef8544f2016-01-16 14:51:07 +010057
58done_testing;
59
60__END__