More DWIMminess for Class::Struct: calling the array or hash
[p5sagit/p5-mst-13.2.git] / t / lib / u-max.t
1 BEGIN {
2         chdir 't' if -d 't';
3         @INC = '../lib';
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         }
9 }
10
11 use List::Util qw(max);
12
13 print "1..5\n";
14
15 print "not " unless defined &max;
16 print "ok 1\n";
17
18 print "not " unless max(1) == 1;
19 print "ok 2\n";
20
21 print "not " unless max(1,2) == 2;
22 print "ok 3\n";
23
24 print "not " unless max(2,1) == 2;
25 print "ok 4\n";
26
27 my @a = map { rand() } 1 .. 20;
28 my @b = sort { $a <=> $b } @a;
29 print "not " unless max(@a) == $b[-1];
30 print "ok 5\n";