implemented Squared distance and their test