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