Change: test suite fails on Ruby 1.8

Hashes don't have an order, so I tried to refactor the library
code and the test cases into more meaningful tests which do not
rely on the order of the generated string.