diceware: add default wordlist to exercise tests
This commit is contained in:
parent
5395b4853b
commit
ab8f6a43ee
2 changed files with 7794 additions and 0 deletions
7776
passgen/diceware/src/main/resources/diceware_wordlist.txt
Normal file
7776
passgen/diceware/src/main/resources/diceware_wordlist.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
package dev.msfjarvis.aps.passgen.diceware
|
package dev.msfjarvis.aps.passgen.diceware
|
||||||
|
|
||||||
|
import java.io.InputStream
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
@ -17,4 +18,21 @@ class WordListParserTest {
|
||||||
assertEquals("abcde", parsedMap[11111])
|
assertEquals("abcde", parsedMap[11111])
|
||||||
assertEquals("fghij", parsedMap[22222])
|
assertEquals("fghij", parsedMap[22222])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun parseDefaultWordList() {
|
||||||
|
val wordlist = getDefaultWordList()
|
||||||
|
val parsedMap = WordListParser.parse(wordlist)
|
||||||
|
assertEquals(7776, parsedMap.size)
|
||||||
|
assertEquals("zoom", parsedMap[66666])
|
||||||
|
assertEquals("salute", parsedMap[52621])
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getDefaultWordList(): InputStream {
|
||||||
|
return requireNotNull(
|
||||||
|
this::class.java.classLoader.getResourceAsStream("diceware_wordlist.txt")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue