Fix diff case
[lightning.git] / hgvs / diff_test.go
index cc211b5f2deecdacd25b562f998263ed4fcf574a..3cac5db020eedd2c86969ec25854c774950132ec 100644 (file)
@@ -61,7 +61,7 @@ func (s *diffSuite) TestDiff(c *check.C) {
                {
                        a:      "aaGGttAAtttt",
                        b:      "aaCCttttttC",
-                       expect: []string{"3_4delinsCC", "7_8del", "12_13insC"},
+                       expect: []string{"3G>C", "4G>C", "7_8del", "12_13insC"},
                },
                {
                        // without cleanup, diffmatchpatch solves this as {"3del", "=A", "4_5insA"}
@@ -73,13 +73,13 @@ func (s *diffSuite) TestDiff(c *check.C) {
                        // without cleanup, diffmatchpatch solves this as {"3_4del", "=A", "5_6insAA"}
                        a:      "agggaggggg",
                        b:      "agAAaggggg",
-                       expect: []string{"3_4delinsAA"},
+                       expect: []string{"3G>A", "4G>A"},
                },
                {
                        // without cleanup, diffmatchpatch solves this as {"3_4del", "=A", "5_6insCA"}
                        a:      "agggaggggg",
                        b:      "agACaggggg",
-                       expect: []string{"3_4delinsAC"},
+                       expect: []string{"3G>A", "4G>C"},
                },
                {
                        // without cleanup, diffmatchpatch solves this as {"3_7del", "=A", "8_9insAAACA"}
@@ -96,12 +96,17 @@ func (s *diffSuite) TestDiff(c *check.C) {
                {
                        a:      "agggaggggg",
                        b:      "agCAaggggg",
-                       expect: []string{"3_4delinsCA"},
+                       expect: []string{"3G>C", "4G>A"},
                },
                {
                        a:      "agggg",
                        b:      "agAAg",
-                       expect: []string{"3_4delinsAA"},
+                       expect: []string{"3G>A", "4G>A"},
+               },
+               {
+                       a:      "aggggg",
+                       b:      "agAAAg",
+                       expect: []string{"3_5delinsAAA"},
                },
                {
                        a:      "acgtgaa",
@@ -113,6 +118,85 @@ func (s *diffSuite) TestDiff(c *check.C) {
                        b:      "tcaAaagac",
                        expect: []string{"4G>A"},
                },
+               {
+                       a:      "tcagatggac",
+                       b:      "tcaAaCggac",
+                       expect: []string{"4G>A", "6T>C"},
+               },
+               {
+                       a:      "tcagatggac",
+                       b:      "tcaAaCggTc",
+                       expect: []string{"4G>A", "6T>C", "9A>T"},
+               },
+               {
+                       a:      "tcagatggac",
+                       b:      "tcaAaCCggTc",
+                       expect: []string{"4G>A", "6delinsCC", "9A>T"},
+               },
+               {
+                       a:      "tcatagagac",
+                       b:      "tcacaagac",
+                       expect: []string{"4T>C", "6del"},
+               },
+               {
+                       a:      "tcatcgagac",
+                       b:      "tcGCcgagac",
+                       expect: []string{"3A>G", "4T>C"},
+               },
+               {
+                       a:      "tcatcgagac",
+                       b:      "tcGCcggac",
+                       expect: []string{"3A>G", "4T>C", "7del"},
+               },
+               {
+                       // should delete leftmost
+                       a:      "acgacaTTtttacac",
+                       b:      "acgacatttacac",
+                       expect: []string{"7_8del"},
+               },
+               {
+                       // should delete leftmost
+                       a:      "acgacATatatacac",
+                       b:      "acgacatatacac",
+                       expect: []string{"6_7del"},
+               },
+               {
+                       // should insert leftmost
+                       a:      "acgacatttacac",
+                       b:      "acgacaTTtttacac",
+                       expect: []string{"6_7insTT"},
+               },
+               {
+                       // should insert leftmost
+                       a:      "acgacatatacac",
+                       b:      "acgacATatatacac",
+                       expect: []string{"5_6insAT"},
+               },
+               {
+                       a:      "cccacGATAtatcc",
+                       b:      "cccactatcc",
+                       expect: []string{"6_9del"},
+               },
+               {
+                       a:      "acGATAtatcc",
+                       b:      "actatcc",
+                       expect: []string{"3_6del"},
+               },
+               {
+                       a:      "acTTTTTatcc",
+                       b:      "acGTTTatcc",
+                       expect: []string{"3_4delinsG"},
+               },
+               {
+                       a:      "acTTTTatcc",
+                       b:      "acGTTTTTatcc",
+                       expect: []string{"2_3insGT"},
+               },
+               {
+                       a:      "aGACGGACAGGGCCCgg",
+                       b:      "agg",
+                       expect: []string{"3_15del"},
+               },
        } {
                c.Log(trial)
                var vars []string