Reputation: 4318
I've seen some examples for ranges.
assert (0.0 .. 1.0).contains(0.5)
I would expecte True for this but I am getting false for this?
Any clue why this assertion failed?
Upvotes: 1
Views: 153
Reputation: 123910
A groovy.lang.Range
is a List
of Comparable
values, two in this case. That's why List.contains
returns false
for 0.5
. What you want instead is Range.containsWithinBounds
.
Upvotes: 1