improve DistanceMatrix test cases