Merge branch 'features/JAL-845splitPaneMergeDevelop' into develop
[jalview.git] / test / jalview / util / ShiftListTest.java
diff --git a/test/jalview/util/ShiftListTest.java b/test/jalview/util/ShiftListTest.java
new file mode 100644 (file)
index 0000000..f680d6c
--- /dev/null
@@ -0,0 +1,35 @@
+package jalview.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+
+public class ShiftListTest
+{
+
+  @Test
+  public void testParseMap()
+  {
+    assertNull(ShiftList.parseMap(null));
+    assertNull(ShiftList.parseMap(new int[]
+    {}));
+    
+    /*
+     * Gap map showing residues in aligned positions 2,3,6,8,9,10,12
+     */
+    int[] gm = new int[]
+    { 2, 3, 6, 8, 9, 10, 12 };
+    List<int[]> shifts = ShiftList.parseMap(gm).getShifts();
+    assertEquals(4, shifts.size());
+
+    // TODO are these results (which pass) correct??
+    assertEquals("[0, 2]", Arrays.toString(shifts.get(0)));
+    assertEquals("[4, 2]", Arrays.toString(shifts.get(1)));
+    assertEquals("[7, 1]", Arrays.toString(shifts.get(2)));
+    assertEquals("[11, 1]", Arrays.toString(shifts.get(3)));
+  }
+}