1#!./perl 2 3BEGIN { 4 unless (-d 'blib') { 5 chdir 't' if -d 't'; 6 @INC = '../lib'; 7 require Config; import Config; 8 keys %Config; # Silence warning 9 if ($Config{extensions} !~ /\bList\/Util\b/) { 10 print "1..0 # Skip: List::Util was not built\n"; 11 exit 0; 12 } 13 } 14} 15 16 17use List::Util qw(maxstr); 18 19print "1..5\n"; 20 21print "not " unless defined &maxstr; 22print "ok 1\n"; 23 24print "not " unless maxstr('a') eq 'a'; 25print "ok 2\n"; 26 27print "not " unless maxstr('a','b') eq 'b'; 28print "ok 3\n"; 29 30print "not " unless maxstr('B','A') eq 'B'; 31print "ok 4\n"; 32 33my @a = map { pack("u", pack("C*",map { int(rand(256))} (0..int(rand(10) + 2)))) } 0 .. 20; 34my @b = sort { $a cmp $b } @a; 35print "not " unless maxstr(@a) eq $b[-1]; 36print "ok 5\n"; 37