# vim:set filetype=perl sw=4 et:
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 08_part.t'

#########################

use Test::More tests => 21;
use Carp;

BEGIN { use_ok 'Lingua::Zompist::Barakhinei', 'part' }

sub form_ok ($$$) {
    # croak 'usage: form_ok($verb, $is, $should)' unless @_ >= 3;
    my($verb, $is, $should) = @_;

    is($is->[0], $should->[0], "present participle of $verb");
    is($is->[1], $should->[1], "past participle of $verb");
}

form_ok('elirę',  scalar(part('elirę',  1)), [ qw( eliril eliręl ) ]);
form_ok('rikha',  scalar(part('rikha',  2)), [ qw( rikhę  rikhu  ) ]);
form_ok('lelę',   scalar(part('lelę',   3)), [ qw( lelę   lelu   ) ]);
form_ok('bęshti', scalar(part('bęshti', 4)), [ qw( bęshti bękchu ) ]);
form_ok('habę',   scalar(part('habę',   5)), [ qw( habę   habęl  ) ]);

# And now test the list context return by using [ ] to capture the output
form_ok('elirę',  [ part('elirę',  1) ], [ qw( eliril eliręl ) ]);
form_ok('rikha',  [ part('rikha',  2) ], [ qw( rikhę  rikhu  ) ]);
form_ok('lelę',   [ part('lelę',   3) ], [ qw( lelę   lelu   ) ]);
form_ok('bęshti', [ part('bęshti', 4) ], [ qw( bęshti bękchu ) ]);
form_ok('habę',   [ part('habę',   5) ], [ qw( habę   habęl  ) ]);
