Implement test for toArray and iterator.