private static void update(String password, Match m, int l, Optimal optimal, boolean excludeAdditive) { int k = m.j; double pi = new EstimateGuess(password).exec(m); if (l > 1) { pi *= optimal.pi.get(m.i - 1).get(l - 1);
private static void update(String password, Match m, int l, Optimal optimal, boolean excludeAdditive) { int k = m.j; double pi = new EstimateGuess(password).exec(m); if (l > 1) { pi *= optimal.pi.get(m.i - 1).get(l - 1);
@Test public void testCalcGuessesPassword() throws Exception { Match match = new Match.Builder(Pattern.Dictionary, 0, 8, "password").guesses(1.0).build(); String msg = "estimate_guesses returns cached guesses when available"; assertEquals(msg, 1, new EstimateGuess("password").exec(match), 0.0); }
@Test public void testCalcGuessesYear() throws Exception { Match match = MatchFactory.createDateMatch(0, 0, "1977", "/", 1977, 7, 14); String msg = "estimate_guesses delegates based on pattern"; assertEquals(msg, new EstimateGuess("1977").exec(match), new DateGuess().exec(match), 0.0); }