Distance algorithm test