use warnings;
use Test::More tests => @TestSizes * 2 # sort() tests
- * 4 # number of pragmas to test
+ * 6 # number of pragmas to test
+ 1 # extra test for qsort instability
+ 3 # tests for sort::current
+ 3; # tests for "defaults" and "no sort"
no sort qw(_qsort);
my $sort_current; BEGIN { $sort_current = sort::current(); }
is($sort_current, 'stable', 'sort::current after no _qsort');
+ main(sub { sort {&{$_[0]}} @{$_[1]} }, 0);
}
{
use sort qw(defaults _qsort);
my $sort_current; BEGIN { $sort_current = sort::current(); }
is($sort_current, 'quicksort', 'sort::current after defaults _qsort');
+ # Not expected to be stable, so don't test for stability here
}
{
use sort qw(defaults stable);
my $sort_current; BEGIN { $sort_current = sort::current(); }
is($sort_current, 'stable', 'sort::current after defaults stable');
+ main(sub { sort {&{$_[0]}} @{$_[1]} }, 0);
}
if (nmemb <= 1) return; /* sorted trivially */
- if (flags) {
+ if ((flags & SORTf_DESC) != 0) {
savecmp = PL_sort_RealCmp; /* Save current comparison routine, if any */
PL_sort_RealCmp = cmp; /* Put comparison routine where cmp_desc can find it */
cmp = cmp_desc;