Fixed NearestInSpan to return -1 when out of bounds and panic with bad bounds. Fixed tests to be table driven.