added test for distance
better djikstra