1#!./perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 5;
7use List::Util qw(minstr);
8
9my $v;
10
11ok(defined &minstr, 'defined');
12
13$v = minstr('a');
14is($v, 'a', 'single arg');
15
16$v = minstr('a','b');
17is($v, 'a', '2-arg ordered');
18
19$v = minstr('B','A');
20is($v, 'A', '2-arg reverse ordered');
21
22my @a = map { pack("u", pack("C*",map { int(rand(256))} (0..int(rand(10) + 2)))) } 0 .. 20;
23my @b = sort { $a cmp $b } @a;
24$v = minstr(@a);
25is($v, $b[0], 'random ordered');
26