develooper Front page | perl.perl5.porters | Postings from July 2004

Re: more 5.9 sort tests

From:
Rafael Garcia-Suarez
Date:
July 21, 2004 05:41
Subject:
Re: more 5.9 sort tests
Message ID:
20040721143735.6c442f01@localhost
david nicol wrote:
> @@ -577,6 +577,13 @@
>  @input = sort {$b <=> $a} @input;
>  ok "@input", "G H I D E F A B C", 'stable $b <=> $a in place sort';
>  
> +# test that optimized {$b cmp $a} remains stable (new in 5.9)
> +# without overloading
> +@b = sort { $b <=> $a } @input = qw/5first 6first 5second 6second/;

I assume you meant "cmp" instead of "<=>" here ?

> +ok "@b" , "6first 6second 5first 5second", "optimized {$b cmp $a} without overloading" ;
> +@input = sort {$b <=> $a} @input;
> +ok "@input" , "6first 6second 5first 5second","inline optimized {$b cmp $a} without overloading" ;
> +
>  # These two are actually doing string cmp on 0 1 and 2
>  @input = &generate1;
>  @output = reverse sort @input;



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About