Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Replace 'no_plan' with fixed number using Test::More when output is random

by Ovid (Cardinal)
on Aug 17, 2007 at 08:16 UTC ( #633244=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://633244]
help
Chatterbox?
[choroba]: What was that? asks he
[choroba]: and the triangle player says, "That was me. It's written here in the score"
[choroba]: and shows a bar with a note "ohne Triangel"
[choroba]: where "ohne" means "will bend" in Czech
[LanX]: one-day-the- triangle-player-of -an-orchestra-gets -very-sick xD
[choroba]: :)

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2017-03-27 12:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (319 votes). Check out past polls.