File: strings.t

package info (click to toggle)
libsort-key-perl 1.33-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 344 kB
  • sloc: perl: 493; ansic: 212; makefile: 2
file content (12 lines) | stat: -rw-r--r-- 353 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use Test::More tests => 4;
BEGIN { use_ok('Sort::Key') };

use Sort::Key qw(keysort nkeysort);

@data=map { rand(200)-100 } 1..10000;

is_deeply([keysort {$_} @data], [sort @data], 'id');
is_deeply([nkeysort {$_} @data], [sort {$a<=>$b} @data], 'n id');
is_deeply([nkeysort {$_ * $_} @data], [sort { $a*$a <=> $b*$b } @data], 'n sqr');