unit test for nearest_centroid