TestDiffLinesLargeInput ensures the implementation handles large inputs without excessive memory usage.
(t *testing.T)
| 153 | // TestDiffLinesLargeInput ensures the implementation handles large inputs |
| 154 | // without excessive memory usage. |
| 155 | func TestDiffLinesLargeInput(t *testing.T) { |
| 156 | if testing.Short() { |
| 157 | t.Skip("skipping large input test in short mode") |
| 158 | } |
| 159 | |
| 160 | N := 5000 |
| 161 | seq1 := make([]string, N) |
| 162 | seq2 := make([]string, N) |
| 163 | for i := 0; i < N; i++ { |
| 164 | seq1[i] = fmt.Sprintf("line %d", i) |
| 165 | if i%3 == 0 { |
| 166 | seq2[i] = fmt.Sprintf("changed %d", i) |
| 167 | } else { |
| 168 | seq2[i] = seq1[i] |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | records := diffLines(seq1, seq2) |
| 173 | require.NotEmpty(t, records) |
| 174 | } |
| 175 | |
| 176 | // lcsLength computes the LCS length using the standard O(N*M) DP. |
| 177 | // Used only in tests to verify correctness. |
nothing calls this directly
no test coverage detected