package com.rusefi.ui.test;

import com.rusefi.ui.engine.EngineSnifferPanel;
import com.rusefi.ui.engine.NameUtil;
import org.junit.Test;

import java.util.Set;
import java.util.TreeSet;

import static junit.framework.Assert.assertEquals;

/**
 * 6/25/14
 * (c) Andrey Belomutskiy
 */

public class EngineSnifferPanelTest {
    @Test
    public void testInsertIndex() {
        Set<String> names = new TreeSet<>();
        names.add(NameUtil.CRANK1);

        String name;

        name = "inj2";
        assertEquals(-1, EngineSnifferPanel.getInsertIndex(name, names));
        names.add(name);

        name = "inj1";
        assertEquals(0, EngineSnifferPanel.getInsertIndex(name, names));
        names.add(name);


        assertEquals(0, EngineSnifferPanel.getInsertIndex("spa1", names));
    }
}

