blob: 87fa58437cb742aa0ddbbff8b136ab64ee4538db [file] [log] [blame]
Akron1622dd92015-12-09 22:34:26 +01001#!/usr/bin/env perl
2# source ~/perl5/perlbrew/etc/bashrc
3# perlbrew switch perl-blead@korap
4use strict;
5use warnings;
6use utf8;
7use Test::More;
8use Benchmark ':hireswallclock';
9use lib 'lib', '../lib';
10
11use_ok('KorAP::Field::MultiTerm');
12
13ok(my $term = KorAP::Field::MultiTerm->new(
14 term => 'Baum',
15 p_start => 0,
16 p_end => 56,
17 payload => '<i>56',
18 o_start => 34,
19 o_end => 120
20), 'Create new object');
21
22is($term->term, 'Baum');
23is($term->p_start, 0);
24is($term->p_end, 56);
25is($term->o_start, 34);
26is($term->o_end, 120);
27is($term->payload, '<i>56');
Akron9c0488f2016-01-28 14:17:15 +010028is($term->to_string, 'Baum$<i>34<i>120<i>56<i>56');
Akron1622dd92015-12-09 22:34:26 +010029
30ok($term = KorAP::Field::MultiTerm->new(
31 term => 'Baum'
32), 'Create new object');
33
34is($term->term, 'Baum');
35is($term->p_start, 0);
36is($term->p_end, 0);
37is($term->o_start, 0);
38is($term->o_end, 0);
39is($term->payload, undef);
40is($term->to_string, 'Baum');
41
42ok($term = KorAP::Field::MultiTerm->new(
43 term => 'Ba#um'
44), 'Create new object');
45
46is($term->term, 'Ba#um');
47is($term->p_start, 0);
48is($term->p_end, 0);
49is($term->o_start, 0);
50is($term->o_end, 0);
51is($term->payload, undef);
52is($term->to_string, 'Ba\#um');
53
54ok($term = KorAP::Field::MultiTerm->new(
55 term => 'Ba#u$m',
56 payload => '<i>45'
57), 'Create new object');
58
59is($term->term, 'Ba#u$m');
60is($term->p_start, 0);
61is($term->p_end, 0);
62is($term->o_start, 0);
63is($term->o_end, 0);
64is($term->payload, '<i>45');
65is($term->to_string, 'Ba\#u\$m$<i>45');
66
67done_testing;
68__END__