001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.collections.primitives.adapters; 018 019import java.util.Iterator; 020 021import junit.framework.Test; 022import junit.framework.TestSuite; 023 024import org.apache.commons.collections.iterators.AbstractTestIterator; 025import org.apache.commons.collections.primitives.ArrayDoubleList; 026import org.apache.commons.collections.primitives.DoubleList; 027 028/** 029 * @version $Revision: 480451 $ $Date: 2006-11-29 02:45:08 -0500 (Wed, 29 Nov 2006) $ 030 * @author Rodney Waldhoff 031 */ 032public class TestDoubleIteratorIterator extends AbstractTestIterator { 033 034 // conventional 035 // ------------------------------------------------------------------------ 036 037 public TestDoubleIteratorIterator(String testName) { 038 super(testName); 039 } 040 041 public static Test suite() { 042 return new TestSuite(TestDoubleIteratorIterator.class); 043 } 044 045 // collections testing framework 046 // ------------------------------------------------------------------------ 047 048 public Iterator makeEmptyIterator() { 049 return DoubleIteratorIterator.wrap(makeEmptyDoubleList().iterator()); 050 } 051 052 public Iterator makeFullIterator() { 053 return DoubleIteratorIterator.wrap(makeFullDoubleList().iterator()); 054 } 055 056 protected DoubleList makeEmptyDoubleList() { 057 return new ArrayDoubleList(); 058 } 059 060 protected DoubleList makeFullDoubleList() { 061 DoubleList list = makeEmptyDoubleList(); 062 double[] elts = getFullElements(); 063 for(int i=0;i<elts.length;i++) { 064 list.add((double)elts[i]); 065 } 066 return list; 067 } 068 069 public double[] getFullElements() { 070 return new double[] { (double)0, (double)1, (double)2, (double)3, (double)4, (double)5, (double)6, (double)7, (double)8, (double)9 }; 071 } 072 073 // tests 074 // ------------------------------------------------------------------------ 075 076 077}