Subject: | GRT (un)signed number descending fails |
GRT signed or unsigned DESCENDING number sorts fail. Here's a patch for the GRT.t to add the test and for the Sort.pm to fix the problem:
diff -ur Sort-Maker-0.01/t/GRT.t Sort-Maker-0.01.patched/t/GRT.t
--- Sort-Maker-0.01/t/GRT.t 2004-06-09 01:29:03.000000000 -0400
+++ Sort-Maker-0.01.patched/t/GRT.t 2004-07-02 09:39:29.000000000 -0400
@@ -26,6 +26,13 @@
},
{
skip => 0,
+ name => 'unsigned integer descending',
+ data => [ 32, 2, 9, 7 ],
+ gold => sub { $b <=> $a },
+ args => [ qw( unsigned number descending ) ],
+ },
+ {
+ skip => 0,
name => 'signed integer',
data => [ 32, -2, 9, -7 ],
gold => sub { $a <=> $b },
@@ -33,6 +40,13 @@
},
{
skip => 0,
+ name => 'signed integer descending',
+ data => [ 32, -2, 9, -7 ],
+ gold => sub { $b <=> $a },
+ args => [ qw( signed number descending ) ],
+ },
+ {
+ skip => 0,
name => 'unsigned float',
data => [ 32, 2, 9, 7 ],
gold => sub { $a <=> $b },
diff -ur Sort-Maker-0.01/Sort/Maker.pm Sort-Maker-0.01.patched/Sort/Maker.pm
--- Sort-Maker-0.01/Sort/Maker.pm 2004-06-09 01:55:35.000000000 -0400
+++ Sort-Maker-0.01.patched/Sort/Maker.pm 2004-07-02 09:50:05.000000000 -0400
@@ -669,7 +669,7 @@
}
my $grt_extract = <<CODE ;
- do{ my (\$val) = $key->{code} ; $val_code }
+ do{ my (\$val) = $key->{code} ; $negate$val_code }
CODE
return( $pack_format, $grt_extract, '' ) ;