Make the test more portable.
[p5sagit/p5-mst-13.2.git] / t / lib / u-min.t
1 BEGIN {
2         chdir 't' if -d 't';
3         @INC = '../lib';
4 }
5
6 use List::Util qw(min);
7
8 print "1..5\n";
9
10 print "not " unless defined &min;
11 print "ok 1\n";
12
13 print "not " unless min(9) == 9;
14 print "ok 2\n";
15
16 print "not " unless min(1,2) == 1;
17 print "ok 3\n";
18
19 print "not " unless min(2,1) == 1;
20 print "ok 4\n";
21
22 my @a = map { rand() } 1 .. 20;
23 my @b = sort { $a <=> $b } @a;
24 print "not " unless min(@a) == $b[0];
25 print "ok 5\n";