Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Truly randomized keys() in perl 5.17 - a challenge for testing?

by hdb (Monsignor)
on Oct 01, 2013 at 06:59 UTC ( [id://1056443]=note: print w/replies, xml ) Need Help??


in reply to Re: Truly randomized keys() in perl 5.17 - a challenge for testing?
in thread Truly randomized keys() in perl 5.17 - a challenge for testing?

There is probably no general solution to the problem but each application requires another way of doing the testing. For example, in your serialization example, you could do sorting on the outcome:

$result = join '&', sort split '&', $result;

just for your testing. This seeems to be simple enough that no new bugs are introduced and will not require a sort in your production code.

While de-serialization could be a solution as well, one has to be very careful as it adds additional complexity. For example, if your serialization function returns "a=b&c=d&a=b" because of some bug, it could easily be "fixed" by a de-serialization procedure:

my %hash = map { split '=', $_ } split '&', $result;

Clearly, there are ways around this, like testing for the length of the string as well. But one has to spend extra time for each application and additional complexity can not be avoided.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1056443]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-19 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found