Akron | 7dacd01 | 2020-05-27 12:18:57 +0200 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use Test::More; |
| 5 | use Data::Dumper; |
| 6 | use Mojo::JSON 'decode_json'; |
| 7 | |
| 8 | require_ok 'KorAP::VirtualCorpus::Group'; |
| 9 | |
| 10 | my $vc = KorAP::VirtualCorpus::Group->new; |
| 11 | $vc->union_field('author', 'Goethe'); |
| 12 | $vc->union_field('author', 'Schiller'); |
| 13 | $vc->joint_field('author', 'Fontane'); |
| 14 | |
| 15 | |
| 16 | my $json = decode_json $vc->to_koral->to_string; |
| 17 | |
| 18 | is($json->{collection}->{operation}, 'operation:and'); |
| 19 | is($json->{collection}->{operands}->[0]->{'@type'}, 'koral:doc'); |
| 20 | is($json->{collection}->{operands}->[0]->{'value'}->[0], 'Goethe'); |
| 21 | is($json->{collection}->{operands}->[0]->{'value'}->[1], 'Schiller'); |
| 22 | |
| 23 | done_testing; |