I have the following function for which the ensuring
clause is failing.
def locationToXy(loc: WorldLocation): Option[(Int, Int)] = {
val WorldLocation(lat, lon) = loc
if (lon < lonMin || lon > lonMax || lat < latMin || lat > latMax)
None
else {
Some(unitSqToXy(projection.project(loc)))
}
} ensuring{ xy =>
val m = xy match {
case None => true
case Some((x:Int,y:Int)) => (0 <= x) && (x < width) && (0 <= y) && (y < height)
}
if (!m){
println(s"xy=$xy width=$width height=$height em=$this")
}
m
}
Is there a way for me to access the values which were passed to the function?