vimalkansal (33) [Avatar] Offline
#1
Hi,

I am getting an AssertionError for the following((page 96))

assert (0.0..1.0).contains(0.5)

As per the book, it should not do this. Am I missing something here?

Vimal
vimalkansal (33) [Avatar] Offline
#2
Re: Groovy 1.5 : What's wrong with this statement
I just did (0.0..1.0).each{println it} and it printed just 0.0 and 1.0. That means this example is wrong.
Mittie (397) [Avatar] Offline
#3
Re: Groovy 1.5 : What's wrong with this statement
Hi,

you've hit a difference between Groovy 1.0 as used for the book and Groovy 1.5.
In Groovy 1.5 it works with
(0.0..1.0).containsWithinBounds(0.5)
.

Thanks for posting
Dierk
vimalkansal (33) [Avatar] Offline
#4
Re: Groovy 1.5 : What's wrong with this statement
Thanks