testing distance function