clj-commons / byte-streams

A Rosetta stone for JVM byte representations
417 stars 33 forks source link

compare-bytes not equivalent to clojure.core/compare with strings #8

Closed reiddraper closed 10 years ago

reiddraper commented 10 years ago

Found this playing around with simple-check 0.5.0-SNAPSHOT,

(def one "Q")
(def two "Nb")

(compare one two)
;; => 3

(bs/compare-bytes one two)
;; => -1
reiddraper commented 10 years ago

A smaller counter-example:

"a" and "AA"

ztellman commented 10 years ago

Interesting that the previous version didn't catch this, but very cool that the current one does.

reiddraper commented 10 years ago

Interesting that the previous version didn't catch this, but very cool that the current one does.

Yeah, was a bug in simple-check where the length of the string generated was always size, not a random int between 0 and size. So it never compared to strings that were of different lengths. That's been fixed.