~ubuntu-branches/ubuntu/trusty/libperl5i-perl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/List-Util/maxstr.t

  • Committer: Bazaar Package Importer
  • Author(s): Ivan Kohler
  • Date: 2010-05-08 17:42:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100508174200-7ogg0zrimh9gvcuw
Tags: upstream-2.1.1
ImportĀ upstreamĀ versionĀ 2.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!perl
 
2
 
 
3
use perl5i::latest;
 
4
 
 
5
use Test::More tests => 4;
 
6
 
 
7
my $v;
 
8
 
 
9
$v = ['a']->maxstr;
 
10
is( $v, 'a', 'single arg' );
 
11
 
 
12
$v = [ 'a', 'b' ]->maxstr;
 
13
is( $v, 'b', '2-arg ordered' );
 
14
 
 
15
$v = [ 'B', 'A' ]->maxstr;
 
16
is( $v, 'B', '2-arg reverse ordered' );
 
17
 
 
18
my @a = map {
 
19
    pack( "u", pack( "C*", map { int( rand(256) ) } ( 0 .. int( rand(10) + 2 ) ) ) )
 
20
} 0 .. 20;
 
21
my @b = sort { $a cmp $b } @a;
 
22
$v = @a->maxstr;
 
23
is( $v, $b[-1], 'random ordered' );