Add unittest for iter_sample.