use List::Util 'shuffle'; use Test::More; my $N = 20; # number of tests; max list length my $M = 20; # random number range plan tests => $N; for (1 .. $N) { my @a = shuffle map { int(rand($M)) } 1 .. $N; my @got = map {chomp; $_} `./mysort <<EOF @a -1 EOF`; my @s = sort { $a <=> $b } @a; is_deeply(\@got, \@s) or diag "@got\n@s\n"; }
In reply to Re: Examples of Perl testing other languages
by itub
in thread Examples of Perl testing other languages
by jkeenan1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |