You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BeNumerically finds -1 equal to uint64(math.MaxUint64) and uint(5) not greater than -3 #925
When one operand is a negative signed integer and the other is an unsigned integer, BeNumerically gives the wrong answer: -1 compares == to uint64(math.MaxUint64) in either order, and uint(5) does not compare > to -3, though int(5) does:
I expected the first two to be false and the third true, as the last line gives for int(5). The doc comment says the specific type of number is irrelevant, so I would expect a signed and an unsigned integer to be compared by value.
Tested on v1.43.1, which is also the current master (47f0f87).
BTW, this was found by an automated program that writes property-based tests for various open source projects using hegel (but it has been reviewed by hand before reporting). We've also potentially found (but not yet hand validated) 13 other bugs in gomega. You can see the tests at https://github.com/hegeldev/hegel-zoo/tree/main/targets/go/gomega. Let us know if you would like us to file the other bugs found and/or contribute the tests. NB the tests are currently LLM generated and probably not yet suitable for inclusion as is, but we're happy to help get them into a better state if you want them.
Done! There ended up being slightly fewer than the initial report claimed because, as expected, several of the previously found "bugs" seem bogus. I've reported all of the found issues that look legit.
I've delegated fixing this to Claude and checked the code it generated. Thanks for reporting!
Integer comparisons in BeNumerically now go through math/big, so signed and unsigned integers are compared by their exact value whatever their signedness: -1 no longer equals uint64(math.MaxUint64) and uint(5) is now > -3. (26e3c6b)
Activity
onsi commentedon Sep 23, 2026
cool - yeah please file all the bugs and i'll get them fixed.
DRMacIver commentedon Sep 24, 2026
Done! There ended up being slightly fewer than the initial report claimed because, as expected, several of the previously found "bugs" seem bogus. I've reported all of the found issues that look legit.
changelog: entries for #925-#934
onsi commentedon Sep 24, 2026
I've delegated fixing this to Claude and checked the code it generated. Thanks for reporting!
Integer comparisons in
BeNumericallynow go throughmath/big, so signed and unsigned integers are compared by their exact value whatever their signedness:-1no longer equalsuint64(math.MaxUint64)anduint(5)is now> -3. (26e3c6b)This will be released in v1.44.0.