Help language development. Donate to The Perl Foundation

List::Util zef:lizmat last updated on 2021-09-09

t/maxstr.t
use v6.*;

use List::Util <maxstr>;
use Test;

plan 5;

my $v is default(Nil);

ok defined(&maxstr), 'maxstr defined';

$v = maxstr('a');
is $v, 'a', 'single arg';

$v = maxstr('a','b');
is $v, 'b', '2-arg ordered';

$v = maxstr('B','A');
is $v, 'B', '2-arg reverse ordered';

my @a = "a" .. "z";
my @b = @a.pick(*);
$v = maxstr(@b);
is $v, @a[*-1], 'random ordered';

# vim: expandtab shiftwidth=4