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";
17 use Test::More tests => 8;
18 use List::Util qw(min);
22 ok(defined &min, 'defined');
25 is($v, 9, 'single arg');
28 is($v, 1, '2-arg ordered');
31 is($v, 1, '2-arg reverse ordered');
33 my @a = map { rand() } 1 .. 20;
34 my @b = sort { $a <=> $b } @a;
36 is($v, $b[0], '20-arg random order');
38 my $one = Foo->new(1);
39 my $two = Foo->new(2);
40 my $thr = Foo->new(3);
42 $v = min($one,$two,$thr);
43 is($v, 1, 'overload');
45 $v = min($thr,$two,$one);
46 is($v, 1, 'overload');
51 '""' => sub { ${$_[0]} },
52 '+0' => sub { ${$_[0]} },
57 bless \$value, $class;
62 eval { require bignum; } or skip("Need bignum for testing overloading",1);
67 $v = min($v1,$v2,$v1,$v3,$v1);
68 is($v, $v3, 'bigint');