Akron | ef8544f | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use utf8; |
| 5 | use Test::More; |
| 6 | use lib 't/index'; |
| 7 | use TestInit; |
| 8 | use Scalar::Util qw/weaken/; |
| 9 | use Data::Dumper; |
| 10 | |
| 11 | use_ok('KorAP::Document'); |
| 12 | |
| 13 | ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens'); |
| 14 | |
| 15 | ok($tokens->add('DeReKo', 'Structure'), 'Add Structure'); |
| 16 | |
| 17 | my $data = $tokens->to_data->{data}; |
| 18 | |
| 19 | like($data->{foundries}, qr!dereko/structure!, 'data'); |
| 20 | like($data->{layerInfos}, qr!dereko/s=spans!, 'data'); |
| 21 | |
| 22 | # Empty element (from 0 to 0) on level 1, with TUI 2 |
| 23 | is($data->{stream}->[0]->[1], |
Akron | 69a4a2f | 2016-01-17 12:55:50 +0100 | [diff] [blame] | 24 | '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>0<b>1<s>2', |
Akron | ef8544f | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 25 | 'Empty element'); |
| 26 | |
| 27 | # Attributes: |
| 28 | is($data->{stream}->[0]->[10], |
| 29 | '@:dereko/s:version:1.1$<b>17<s>2', |
| 30 | 'Attribute of idsHeader'); |
| 31 | |
| 32 | is($data->{stream}->[0]->[11], |
| 33 | '@:dereko/s:TEIform:teiHeader$<b>17<s>2', |
| 34 | 'Attribute of idsHeader'); |
| 35 | |
| 36 | is($data->{stream}->[0]->[12], |
| 37 | '@:dereko/s:status:new$<b>17<s>2', |
| 38 | 'Attribute of idsHeader'); |
| 39 | |
| 40 | is($data->{stream}->[0]->[13], |
| 41 | '@:dereko/s:type:text$<b>17<s>2', |
| 42 | 'Attribute of idsHeader'); |
| 43 | |
| 44 | is($data->{stream}->[0]->[14], |
| 45 | '@:dereko/s:pattern:text$<b>17<s>2', |
| 46 | 'Attribute of idsHeader'); |
| 47 | |
| 48 | |
Akron | 69a4a2f | 2016-01-17 12:55:50 +0100 | [diff] [blame] | 49 | is($data->{stream}->[4]->[1], |
| 50 | '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1', |
| 51 | 'Sentence span'); |
| 52 | |
| 53 | is($data->{stream}->[4]->[2], |
| 54 | '@:dereko/s:broken:no$<b>17<s>1<i>6', |
| 55 | 'Attribute of sentence span'); |
| 56 | |
| 57 | is($data->{stream}->[6]->[0], |
| 58 | '<>:dereko/s:pb$<b>65<i>42<i>42<i>6<b>6<s>1', |
| 59 | 'Pagebreak element'); |
Akron | ef8544f | 2016-01-16 14:51:07 +0100 | [diff] [blame] | 60 | |
| 61 | done_testing; |
| 62 | |
| 63 | __END__ |