Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Diagnostic messages in Test::Deepby Athanasius (Archbishop) |
on Jul 21, 2015 at 07:01 UTC ( [id://1135542]=note: print w/replies, xml ) | Need Help?? |
Hello KeighleHawk, Naturally, the array can be returned in random order. Actually, the elements of an array are always in a fixed order — that’s the nature of arrays. I think you mean the array will be populated in a random order? ...part of the structure I am comparing includes an array of hashes.... Initially, I was using a sort on one of the hash fields, but as my data set increased, I started to hit return values with different hash structures so my sorting column needed to change. I don’t understand this. If you are comparing an array of hashes with an unordered list of hashes, it seems to me that you have to proceed in two steps:
From which (I think) it follows that a generic procedure is all that’s required:
Output:
Clearly, Test::More::is_deeply returns a much more informative message on failure than does Test::Deep::cmp_deeply — as you have stated. But in what way does my sub sort_hash fall short of the functionality provided by Test::Deep::bag for your purposes? Please clarify by providing sample input for which the comparison with Test::Deep::bag will work, but a generic comparison based on hash keys will not. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|