distance funtion test