Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by vsespb (Chaplain)
on Sep 30, 2013 at 16:54 UTC ( #1056389=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?

Unless keys() can be switched to a test mode to produce predictable results (doesn't need to be sorted, just give me something predictable, like before perl 5.17), what are the options?
To test hash_serialize():

I would deserialize it to memory, and compare with original hash (with something based on "sort keys" or with cmp_deeply).

However this violates some ideas of unit testing (while it's ok for integration testing).
If it's worrying you - test it for 1-element hash and 2-elements hash (yes, all 2 permutations), and stop. Do other testing with deserialization.

To test other code, which uses hash_serialize():

mock (fake) hash_serialize().
  • Comment on Re^2: Truly randomized keys() in perl 5.17 - a challenge for testing?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056389]
help
Chatterbox?
[Eily]: as in "I might have inverted two, but my eyes misread in the some order as my fingers mistype"
[LanX]: can't find a definition for the sound
[LanX]: Voiceless_palatal_ fricative
[Eily]: Lanx https://en. wikipedia.org/ wiki/Voiceless_pal atal_fricative
Eily got the Cowboy message
[Your Mother]: I prefer palatial fricatives.
[Lotus1]: https://en. wikipedia.org/ wiki/%C3%87
[Your Mother]: I'm headed out west, sucker.
[Lotus1]: the west is the best, get here we'll do the rest
LanX chjuman !

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



    Results (320 votes). Check out past polls.