Write test for nearest_neighbor: fix #5