use warnings;
use Test::More tests => @TestSizes * 2 # sort() tests
- * 6 # number of pragmas to test
- + 1 # extra test for qsort instability
- + 3 # tests for sort::current
- + 3; # tests for "defaults" and "no sort"
+ * 3 # number of pragmas to test
+ + 2; # tests for sort::current
# Generate array of specified size for testing sort.
#
my @ignore = sort (5,4,3,2,1);
return $a <=> $b;
}
- use sort qw( defaults _qsort stable );
+ use sort qw( defaults stable );
my @nested = sort { dumbsort($a,$b) } (3,2,2,1);
}
{
- use sort qw(_qsort);
+ use sort qw(stable);
my $sort_current; BEGIN { $sort_current = sort::current(); }
- is($sort_current, 'quicksort', 'sort::current for _qsort');
- main(sub { sort {&{$_[0]}} @{$_[1]} }, 1);
-}
-
-{
- use sort qw(_mergesort);
- my $sort_current; BEGIN { $sort_current = sort::current(); }
- is($sort_current, 'mergesort', 'sort::current for _mergesort');
- main(sub { sort {&{$_[0]}} @{$_[1]} }, 0);
-}
-
-{
- use sort qw(_qsort stable);
- my $sort_current; BEGIN { $sort_current = sort::current(); }
- is($sort_current, 'quicksort stable', 'sort::current for _qsort stable');
+ is($sort_current, 'stable', 'sort::current for stable');
main(sub { sort {&{$_[0]}} @{$_[1]} }, 0);
}
# Tests added to check "defaults" subpragma, and "no sort"
{
- use sort qw(_qsort stable);
- 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');