blob: cb7f6232277de4943e40cd8ee7e344e8d558dda4 [file] [log] [blame]
Akron1622dd92015-12-09 22:34:26 +01001use strict;
2use warnings;
3use utf8;
4use Test::More;
5use Benchmark ':hireswallclock';
6use lib 'lib', '../lib';
7
Akronafb81ad2016-08-01 20:28:31 +02008use_ok('KorAP::XML::Index::MultiTerm');
Akron1622dd92015-12-09 22:34:26 +01009
Akronafb81ad2016-08-01 20:28:31 +020010ok(my $term = KorAP::XML::Index::MultiTerm->new(
Akron1622dd92015-12-09 22:34:26 +010011 term => 'Baum',
12 p_start => 0,
13 p_end => 56,
14 payload => '<i>56',
15 o_start => 34,
16 o_end => 120
17), 'Create new object');
18
19is($term->term, 'Baum');
20is($term->p_start, 0);
21is($term->p_end, 56);
22is($term->o_start, 34);
23is($term->o_end, 120);
24is($term->payload, '<i>56');
Akron9c0488f2016-01-28 14:17:15 +010025is($term->to_string, 'Baum$<i>34<i>120<i>56<i>56');
Akron1622dd92015-12-09 22:34:26 +010026
Akronafb81ad2016-08-01 20:28:31 +020027ok($term = KorAP::XML::Index::MultiTerm->new(
Akron1622dd92015-12-09 22:34:26 +010028 term => 'Baum'
29), 'Create new object');
30
31is($term->term, 'Baum');
32is($term->p_start, 0);
33is($term->p_end, 0);
34is($term->o_start, 0);
35is($term->o_end, 0);
36is($term->payload, undef);
37is($term->to_string, 'Baum');
38
Akronafb81ad2016-08-01 20:28:31 +020039ok($term = KorAP::XML::Index::MultiTerm->new(
Akron1622dd92015-12-09 22:34:26 +010040 term => 'Ba#um'
41), 'Create new object');
42
43is($term->term, 'Ba#um');
44is($term->p_start, 0);
45is($term->p_end, 0);
46is($term->o_start, 0);
47is($term->o_end, 0);
48is($term->payload, undef);
49is($term->to_string, 'Ba\#um');
50
Akronafb81ad2016-08-01 20:28:31 +020051ok($term = KorAP::XML::Index::MultiTerm->new(
Akron1622dd92015-12-09 22:34:26 +010052 term => 'Ba#u$m',
53 payload => '<i>45'
54), 'Create new object');
55
56is($term->term, 'Ba#u$m');
57is($term->p_start, 0);
58is($term->p_end, 0);
59is($term->o_start, 0);
60is($term->o_end, 0);
61is($term->payload, '<i>45');
62is($term->to_string, 'Ba\#u\$m$<i>45');
63
64done_testing;
65__END__