|Think about Loose Coupling|
Re: Diagnostic messages in Test::Deepby Athanasius (Bishop)
|on Jul 21, 2015 at 07:01 UTC||Need Help??|
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:
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,