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