package jetbrains.mps.baseLanguage.collections.unittest.simple_operations;

/*Generated by MPS */

import junit.framework.TestCase;
import java.util.List;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import java.util.ArrayList;
import junit.framework.Assert;
import java.util.Arrays;

public class ListOperations_Test extends TestCase {
  public ListOperations_Test() {
  }
  public void test_1() {
    List<Integer> list = ListSequence.fromListAndArray(new ArrayList<Integer>(), 1, 2, 3, 4, 5);
    Integer at_2 = ListSequence.fromList(list).getElement(2);
    Assert.assertEquals(3, at_2.intValue());
    int index_2 = ListSequence.fromList(list).indexOf(at_2);
    Assert.assertEquals(2, index_2);
  }
  public void test_2() {
    List<List<Boolean>> llb = ListSequence.fromListAndArray(new ArrayList<List<Boolean>>(), ListSequence.fromListAndArray(new ArrayList<Boolean>(), false, true));
    org.junit.Assert.assertSame(2, ListSequence.fromList(ListSequence.fromList(llb).first()).count());
    org.junit.Assert.assertSame(false, ListSequence.fromList(ListSequence.fromList(llb).first()).first());
  }
  public void test_3() {
    List<Integer> li = Arrays.asList(1, 2, 3, 4, 5);
    List<Integer> lo = ListSequence.fromList(li).concat(ListSequence.fromList(li)).distinct().toList();
    org.junit.Assert.assertEquals(li, lo);
  }
}
