Commit | Line | Data |
1bfb5477 |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | unless (-d 'blib') { |
5 | chdir 't' if -d 't'; |
6 | @INC = '../lib'; |
7 | require Config; import Config; |
8 | keys %Config; # Silence warning |
9 | if ($Config{extensions} !~ /\bList\/Util\b/) { |
10 | print "1..0 # Skip: List::Util was not built\n"; |
11 | exit 0; |
12 | } |
13 | } |
14 | } |
15 | |
cf083cf9 |
16 | use Test::More tests => 6; |
1bfb5477 |
17 | |
18 | use List::Util qw(shuffle); |
19 | |
1bfb5477 |
20 | my @r; |
21 | |
22 | @r = shuffle(); |
cf083cf9 |
23 | ok( !@r, 'no args'); |
1bfb5477 |
24 | |
25 | @r = shuffle(9); |
cf083cf9 |
26 | is( 0+@r, 1, '1 in 1 out'); |
27 | is( $r[0], 9, 'one arg'); |
1bfb5477 |
28 | |
29 | my @in = 1..100; |
30 | @r = shuffle(@in); |
cf083cf9 |
31 | is( 0+@r, 0+@in, 'arg count'); |
1bfb5477 |
32 | |
cf083cf9 |
33 | isnt( "@r", "@in", 'result different to args'); |
1bfb5477 |
34 | |
cf083cf9 |
35 | my @s = sort { $a <=> $b } @r; |
36 | is( "@in", "@s", 'values'); |