assertEquals(expected, result, 0.5);
}
@Test
public void twoPattern_overlap() {
PasswordAnalysis pa = new PasswordAnalysis("12345");
pa.foundPattern(new PasswordPattern(1, 1, "2", 15, "badPattern"));
pa.foundPattern(new PasswordPattern(1, 1, "2", 4, "bestPattern"));
pa.foundPattern(new PasswordPattern(1, 1, "2", 20, "worserPattern"));
pa.foundPattern(new PasswordPattern(1, 1, "2", 23, "worstPattern"));
pa.foundPattern(new PasswordPattern(2, 2, "34", 15, "badPattern"));
pa.foundPattern(new PasswordPattern(2, 2, "34", 20, "worserPattern"));
pa.foundPattern(new PasswordPattern(2, 2, "34", 23, "worstPattern"));
pa.foundPattern(new PasswordPattern(2, 2, "34", 4, "bestPattern"));
pa.foundPattern(new PasswordPattern(4, 1, "5", 15, "badPattern"));
pa.foundPattern(new PasswordPattern(4, 1, "5", 20, "worserPattern"));
pa.foundPattern(new PasswordPattern(4, 1, "5", 4, "bestPattern"));
pa.foundPattern(new PasswordPattern(4, 1, "5", 23, "worstPattern"));
PathCost patterns = pa.calculateHighestProbablePatterns();
List<PasswordPattern> list = patterns.getPath();
assertEquals(4, list.size());
double result = patterns.getTotalCost();
System.out.println("cost=" + result);