File: max.t

package info (click to toggle)
libautobox-list-util-perl 20090629-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 116 kB
  • ctags: 12
  • sloc: perl: 59; makefile: 2
file content (21 lines) | stat: -rwxr-xr-x 341 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use blib;
use strict;
use autobox::List::Util;

use Test::More tests => 4;

my $v;

$v = [1]->max;
is($v, 1, 'single arg');

$v = [1,2]->max;
is($v, 2, '2-arg ordered');

$v = [2,1]->max;
is($v, 2, '2-arg reverse ordered');

my @a = map { rand() } 1 .. 20;
my @b = sort { $a <=> $b } @a;
$v = @a->max;
is($v, $b[-1], '20-arg random order');