(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func TestIsDiffSmaller(t *testing.T) { |
| 65 | // Small change to large doc — diff should be smaller |
| 66 | large := strings.Repeat("Line of text\n", 100) |
| 67 | modified := large + "Added line\n" |
| 68 | patch := CreatePatch(large, modified) |
| 69 | if !IsDiffSmaller(patch, large) { |
| 70 | t.Errorf("expected diff (%d bytes) to be smaller than full content (%d bytes)", len(patch), len(large)) |
| 71 | } |
| 72 | |
| 73 | // Near-complete rewrite — diff should NOT be smaller |
| 74 | completely := strings.Repeat("Totally different\n", 100) |
| 75 | patch2 := CreatePatch(large, completely) |
| 76 | if IsDiffSmaller(patch2, large) { |
| 77 | t.Errorf("expected diff (%d bytes) to NOT be smaller for complete rewrite (%d bytes)", len(patch2), len(large)) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestIsDiffSmallerEmptyContent(t *testing.T) { |
| 82 | if IsDiffSmaller("some patch", "") { |
nothing calls this directly
no test coverage detected