Am 07.09.2015 12:08, schrieb Thibault Kruse:
[...]
I was not sure that it does, looking at the code, so I looked to
extend the unit test.
I found it has no unit test.  Finding this makes me sad.

that's because the method is not really part of an API and is instead tested through groovy scripts using the comparison operators and other means. That does of course not mean those tests are extensive enough.

Anyway, I wrote some tests, to find there are several issues with symmetry:
https://github.com/tkruse/incubator-groovy/commit/aa8d201cbbca6823adbacf15cddfc7dd68881a13
Given there were no tests, I am not too surprised to find bugs.

To have a bug we would first need a well defined behaviour

So I would recommend fixing those, then adding some more tests with
other Comparables or Objects with compareTo, and make sure that it
behaves symmetrically and consistently.

and what is the "expected" behaviour?

bye blackdrag

--
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/

Reply via email to