/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.collection.lists;

import net.ranides.assira.collection.iterators.IntListIterator;
import net.ranides.assira.ContractTesters;
import net.ranides.assira.collection.mockup.TMaps;
import net.ranides.assira.test.TCollection;
import org.junit.Test;

/**
 *
 * @author Ranides Atterwim <ranides@gmail.com>
 */
public class AIntListTest {
    
    private final TCollection<Integer> $var = TMaps.MAP_IS.keys();

    @Test
    public void testSuite() {
        ContractTesters.runner()
			.param("collection!", $var)
			.function(new int[0], array -> new FIntList($var.list(array).valuesInt()))
			.run();
    }
    
    private static class FIntList extends AIntList {
        
        private final IntArrayList data;
        
        @SuppressWarnings("PMD")
        public FIntList(int[] values) {
            data = new IntArrayList(values);
        }

        @Override
        public int size() {
            return data.size();
        }

        @Override
        public boolean add(int k) {
            return data.add(k);
        }
        
        @Override
        public void add(int index, int k) {
            data.add(index, k);
        }

        @Override
        public int getInt(int index) {
            return data.getInt(index);
        }

        @Override
        public IntListIterator listIterator(int index) {
            return data.listIterator(index);
        }

        @Override
        public int removeInt(int index) {
            return data.removeInt(index);
        }

        @Override
        public int set(int index, int k) {
            return data.set(index, k);
        }
        
    }
    
}
