1use Test::More; 2use strict; use warnings FATAL => 'all'; 3 4use List::Objects::WithUtils 'array'; 5 6my $arr = array(1, 2, 3); 7my $shuffled = $arr->shuffle; 8 9ok 10 $shuffled->has_any(sub { $_ == 1 }) 11 && $shuffled->has_any(sub { $_ == 2 }) 12 && $shuffled->has_any(sub { $_ == 3 }) 13 && $shuffled->count == 3, 14 'shuffle() ok'; 15 16is_deeply 17 [ $arr->all ], 18 [ 1, 2, 3 ], 19 'original array intact'; 20 21 22ok array->shuffle->is_empty, 'empty array shuffle ok'; 23 24done_testing; 25