package jetbrains.mps.internalCollections.test.basicOperations; /*Generated by MPS */ import jetbrains.mps.internalCollections.test.closures.Util_Test; import java.util.SortedMap; import jetbrains.mps.internal.collections.runtime.SortedMapSequence; import java.util.TreeMap; import java.util.Arrays; public class SortedMap_Test extends Util_Test { public void test_sortedMap() throws Exception { SortedMap<String, Integer> smap = SortedMapSequence.<String, Integer>fromMapAndKeysArray(new TreeMap<String, Integer>(), "C", "A", "B", "E", "D").withValues(3, 1, 2, 5, 4); this.assertIterableEquals(SortedMapSequence.fromMap(smap).values(), this.input5()); } public void test_headMap() throws Exception { SortedMap<String, Integer> smap = SortedMapSequence.<String, Integer>fromMapAndKeysArray(new TreeMap<String, Integer>(), "C", "A", "B", "E", "D").withValues(3, 1, 2, 5, 4); SortedMap<String, Integer> submap = SortedMapSequence.fromMap(smap).headMap("C"); this.assertIterableEquals(Arrays.asList(1, 2), SortedMapSequence.fromMap(submap).values()); this.assertIterableEquals(Arrays.asList(1, 2, 3), SortedMapSequence.fromMap(SortedMapSequence.fromMap(smap).headMap("C\0")).values()); } public void test_tailMap() throws Exception { SortedMap<String, Integer> smap = SortedMapSequence.<String, Integer>fromMapAndKeysArray(new TreeMap<String, Integer>(), "C", "A", "B", "E", "D").withValues(3, 1, 2, 5, 4); SortedMap<String, Integer> submap = SortedMapSequence.fromMap(smap).tailMap("C"); this.assertIterableEquals(Arrays.asList(3, 4, 5), SortedMapSequence.fromMap(submap).values()); } public void test_subMap() throws Exception { SortedMap<String, Integer> smap = SortedMapSequence.<String, Integer>fromMapAndKeysArray(new TreeMap<String, Integer>(), "C", "A", "B", "E", "D").withValues(3, 1, 2, 5, 4); SortedMap<String, Integer> submap = SortedMapSequence.fromMap(smap).subMap("B", "E"); this.assertIterableEquals(Arrays.asList(2, 3, 4), SortedMapSequence.fromMap(submap).values()); this.assertIterableEquals(Arrays.asList(2, 3, 4, 5), SortedMapSequence.fromMap(SortedMapSequence.fromMap(smap).subMap("B", "E\0")).values()); } public SortedMap_Test() { } }