CodesAway / CodesAway/RegExPlus

LcsString diff0 method does not correctly create a valid diff in all cases (doesn't show correct number of matches)

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

LcsString diff0 method does not correctly create a valid diff in all cases (doesn't show correct number of matches)

```
// diff0 has 0 matching characters, yet should be the same number as LCS
// (this is yielding an invalid diff)
LcsString lcsString = new LcsString("warningmsg", "naming");
// LcsString lcsString = new LcsString("naming", "warningmsg");

System.out.println("LCS: " + lcsString.lcsLength());
System.out.println(
"diff match: " + lcsString.diff().stream().filter(d -> d.getType() == LcsDiffType.NONE).count());
System.out.println(
"diff0 match: " + lcsString.diff0().stream().filter(d -> d.getType() == LcsDiffType.NONE).count());

System.out.println("diff()");
lcsString.diff().forEach(System.out::println);
System.out.println();

System.out.println("diff0()");
lcsString.diff0().forEach(System.out::println);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.