hashids / hashids.github.io

This is the old Hashids website. It is no longer maintained and has migrated over to Sqids.
https://sqids.org
206 stars 34 forks source link

Shared set of hashids tests #76

Closed ChickenProp closed 1 year ago

ChickenProp commented 3 years ago

For each of the 40 implementations listed on the hashids website, has someone made sure they give the same results as each other? I'm sure several of them have been checked against others. But I wouldn't be surprised if at least one of them gives different results.

I feel like the website should have resources for implementers, and one of the resources should be a file containing a long list of unit tests. Possibly in JSON, possibly some other format that's easy to parse. Then implementers can include that file in their own test suites, and just write a (hopefully fairly simple) test runner for them. It would presumably have tests like:

[1]: If using JSON, such numbers might need to be written as strings. Otherwise the parsing step might not preserve them correctly.

ChickenProp commented 3 years ago

Indeed, it seems the postgres implementation is not consistent: https://github.com/array-analytics/plpg_hashids/issues/13

4kimov commented 1 year ago

@ChickenProp Sorry for the late response and I agree - the tests should be the same across implementations. We're fixing that as we're moving to the new algorithm.

Closing since the project is moving.