X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/0e1d050c8bc9db9872018aa565cc957f8169e50c..aa4b50cc509e728b57bbbb5cf5f166f90aae89a4:/lib/sort.t diff --git a/lib/sort.t b/lib/sort.t index 1ff3832..e0ef9d3 100644 --- a/lib/sort.t +++ b/lib/sort.t @@ -26,10 +26,8 @@ use strict; 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. # @@ -144,49 +142,20 @@ main(sub { sort {&{$_[0]}} @{$_[1]} }, 0); 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');