New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero-length equality #3

wants to merge 2 commits into
base: master


None yet
1 participant

milt commented Feb 15, 2017

I was playing with function specs, and happened to notice that when crypto.equality/eq? is given two zero-length strings or byte sequences, ie. (eq? "" ""), it throws:

1. Unhandled clojure.lang.ArityException
   Wrong number of args (0) passed to: core/bit-or

I understand that in the context this is normally used it should never really need to compare zero-length strings, but I thought I'd pass this along anyways. It just seqs the results of mapping int over the inputs, then short-circuits to true if both are nil.

If you ever want to add specs to the project later on, here's the spec that brought it to my attention:

(s/fdef crypto.equality/eq?
        :args (s/cat :a string? :b string?)
        :ret boolean?
        :fn (fn [{:keys [args ret]}]
              (let [{:keys [a b]} args]
                (= (= a b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment