package net.ranides.assira.collection.lists;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.*;

public class IntListGeneratorTest {

    @Test
    public void parseInt() {
        assertEquals(IntList.of(1,2,3,4,8,9,10), IntListGenerator.parse("1-4,8-10"));
        assertEquals(IntList.of(1,2,3,4,10,9,8), IntListGenerator.parse("1-4,10-8"));
    }

    @Test
    public void parseRangeLimit() {
        assertEquals(IntList.of(1,2,3,4), IntListGenerator.parse(5, "1-14"));
    }

    @Test
    public void parseNames() {
        List<String> names = Arrays.asList("a", "b", "c", "d", "e", "f");
        assertEquals(IntList.of(1,2,5,4,0,3), IntListGenerator.parse(names, "1-2,f,e,a,3"));
    }
}