blob: 59b83f368f31430e6e18bad29ed257a46e6849a9 [file] [log] [blame]
Akronb27f6942015-12-09 22:34:26 +01001use strict;
2use warnings;
3use utf8;
4use Test::More;
5use Benchmark ':hireswallclock';
6use lib 'lib', '../lib';
7
Akron8fa76bc2016-01-28 15:10:50 +01008use_ok('KorAP::XML::Field::MultiTerm');
Akronb27f6942015-12-09 22:34:26 +01009
Akron8fa76bc2016-01-28 15:10:50 +010010ok(my $term = KorAP::XML::Field::MultiTerm->new(
Akronb27f6942015-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');
Akron29fc6b72016-01-28 14:17:15 +010025is($term->to_string, 'Baum$<i>34<i>120<i>56<i>56');
Akronb27f6942015-12-09 22:34:26 +010026
Akron8fa76bc2016-01-28 15:10:50 +010027ok($term = KorAP::XML::Field::MultiTerm->new(
Akronb27f6942015-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
Akron8fa76bc2016-01-28 15:10:50 +010039ok($term = KorAP::XML::Field::MultiTerm->new(
Akronb27f6942015-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
Akron8fa76bc2016-01-28 15:10:50 +010051ok($term = KorAP::XML::Field::MultiTerm->new(
Akronb27f6942015-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__