in reply to Replace 'no_plan' with fixed number using Test::More when output is random

Try this:

use Test::More tests => 1; use Dyn; use Data::Dumper; my @arr = Dyn::get_list(); is scalar(grep { qr/^\d+$/ } @arr), scalar(@arr), 'All elements from get_list() should be integers' or diag Dumper(\@arr);

Cheers,
Ovid

New address of my CGI Course.

  • Comment on Re: Replace 'no_plan' with fixed number using Test::More when output is random
  • Download Code

Replies are listed 'Best First'.
Re^2: Replace 'no_plan' with fixed number using Test::More when output is random
by moritz (Cardinal) on Aug 17, 2007 at 08:49 UTC
    I agree, a random number of tests is almost certainly a bad idea.

    If you have random numbers involved, it might be a good idea to run the same test a fixed number of times, depending on the exact nature of your module.