Write test for nearest_neighbor: fix #10