From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more
123456789101112131415161718 #!/usr/bin/perluse warnings;use strict;use Test::More tests => 5;use Sort::Key::Radix qw(usort);for my $range (0xf, 0xaf, 0xaffff, 0xffffff, 0xffffffff) { my @d = map { int($range * rand) } 0..200; my @good = sort { $a <=> $b } @d; my @s = usort @d; is("@s", "@good");}
#!/usr/bin/perl
use
warnings;
strict;
Test::More
tests
=> 5;
Sort::Key::Radix
qw(usort)
;
for
my
$range
(0xf, 0xaf, 0xaffff, 0xffffff, 0xffffffff) {
@d
=
map
{
int
(
*
rand
) } 0..200;
@good
sort
$a
<=>
$b
}
@s
= usort
is(
"@s"
,
"@good"
);