@Test public void testDictionaryGuesses133t() throws Exception { Map<Character, Character> sub = new HashMap<>(); sub.put('@', 'a'); Match match = new Match.Builder(Pattern.Dictionary, 0, 0, "aaa@@@").sub(sub).l33t(true).rank(32).build(); String msg = "extra guesses are added for common l33t substitutions"; assertEquals(msg, 32 * new DictionaryGuess().l33tVariations(match), new DictionaryGuess().exec(match), 0.0); }
@Test public void testDictionaryGuessesSameWithRank() throws Exception { Match match = new Match.Builder(Pattern.Dictionary, 0, 0, "aaaa").rank(32).build(); String msg = "base guesses == the rank"; assertEquals(msg, 32, new DictionaryGuess().exec(match), 0.0); }
@Test public void testDictionaryGuessesMixed() throws Exception { Map<Character, Character> sub = new HashMap<>(); sub.put('@', 'a'); Match match = new Match.Builder(Pattern.Dictionary, 0, 0, "AaA@@@").sub(sub).l33t(true).rank(32).build(); String msg = "extra guesses are added for both capitalization and common l33t substitutions"; int expected = 32 * new DictionaryGuess().l33tVariations(match) * new DictionaryGuess().uppercaseVariations(match); assertEquals(msg, expected, new DictionaryGuess().exec(match), 0.0); }
@Test public void testDictionaryGuessesReverse() throws Exception { Match match = new Match.Builder(Pattern.Dictionary, 0, 0, "aaa").reversed(true).rank(32).build(); String msg = "guesses are doubled when word is reversed"; assertEquals(msg, 32 * 2, new DictionaryGuess().exec(match), 0.0); }
@Test public void testDictionaryGuessesCapitalization() throws Exception { Match match = new Match.Builder(Pattern.Dictionary, 0, 0, "AAAaaa").rank(32).build(); String msg = "extra guesses are added for capitalization"; assertEquals(msg, 32 * new DictionaryGuess().uppercaseVariations(match), new DictionaryGuess().exec(match), 0.0); }