fix test failures under perl 5.18 and 5.20 (patch from Debian) 

I've created this patch to fix Debian FTBS and PR #8 

 Test failures were due to randomisation of keys %foo.
 
 A sort was added to all calls to keys. The tests were modified to suit the now ordered keys results.