This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
B::walksymtable improperly documented?
[perl5.git] / t / lib / u-minstr.t
CommitLineData
f4a2945e
JH
1BEGIN {
2 chdir 't' if -d 't';
3 @INC = '../lib';
6b05f64e
PP
4 require Config; import Config;
5 if ($Config{extensions} !~ /\bList\/Util\b/) {
6 print "1..0 # Skip: List::Util was not built\n";
7 exit 0;
8 }
f4a2945e
JH
9}
10
11use List::Util qw(minstr);
12
13print "1..5\n";
14
15print "not " unless defined &minstr;
16print "ok 1\n";
17
18print "not " unless minstr('a') eq 'a';
19print "ok 2\n";
20
21print "not " unless minstr('a','b') eq 'a';
22print "ok 3\n";
23
24print "not " unless minstr('B','A') eq 'A';
25print "ok 4\n";
26
27my @a = map { pack("u", pack("C*",map { int(rand(256))} (0..int(rand(10) + 2)))) } 0 .. 20;
28my @b = sort { $a cmp $b } @a;
29print "not " unless minstr(@a) eq $b[0];
30print "ok 5\n";