(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestGetOptCodes(t *testing.T) { |
| 53 | a := "qabxcd" |
| 54 | b := "abycdf" |
| 55 | s := NewMatcher(splitChars(a), splitChars(b)) |
| 56 | w := &bytes.Buffer{} |
| 57 | for _, op := range s.GetOpCodes() { |
| 58 | fmt.Fprintf(w, "%s a[%d:%d], (%s) b[%d:%d] (%s)\n", string(op.Tag), |
| 59 | op.I1, op.I2, a[op.I1:op.I2], op.J1, op.J2, b[op.J1:op.J2]) |
| 60 | } |
| 61 | result := w.String() |
| 62 | expected := `d a[0:1], (q) b[0:0] () |
| 63 | e a[1:3], (ab) b[0:2] (ab) |
| 64 | r a[3:4], (x) b[2:3] (y) |
| 65 | e a[4:6], (cd) b[3:5] (cd) |
| 66 | i a[6:6], () b[5:6] (f) |
| 67 | ` |
| 68 | if expected != result { |
| 69 | t.Errorf("unexpected op codes: \n%s", result) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | func TestGroupedOpCodes(t *testing.T) { |
| 74 | a := []string{} |
nothing calls this directly
no test coverage detected