Algorithm-Numerical-Shuffle

 view release on metacpan or  search on metacpan

t/000_tests.t  view on Meta::CPAN

eval {
    my @a = shuffle ();
    if (@a) {
        print "not ok ", $test_num ++, "\n";
    }
    else {
        print "ok ", $test_num ++, "\n";
    }
};

if ($@) {print "... error: $@\n";}

eval {
    my $a = [];
    shuffle $a;

    if (@$a) {
        print "not ok ", $test_num ++, "\n";
    }
    else {
        print "ok ", $test_num ++, "\n"; 
    }
};

if ($@) {print "... error: $@\n";}

eval {
    my @a  = (0 .. 9);
    my @b  = shuffle @a;
    my @c  = sort {$a <=> $b} @b;

    if (@a != @c || "@a" ne "@c") {
        print "not ok ", $test_num ++, "\n";
    }
    else {
        print "ok ", $test_num ++, "\n";
    }
};

if ($@) {print "... error: $@\n";}

eval {
    my $A  = [0 .. 9];
    my $B  = [0 .. 9];
    shuffle $B;
    my @C  = sort {$a <=> $b} @$B;

    if (@$A != @C || "@$A" ne "@C") {
        print "not ok ", $test_num ++, "\n";
    }
    else {
        print "ok ", $test_num ++, "\n";
    }
};

if ($@) {print "... error: $@\n";}



( run in 0.674 second using v1.01-cache-2.11-cpan-65fba6d93b7 )