diceware: add default wordlist to exercise tests

This commit is contained in:
Harsh Shandilya 2021-12-10 00:32:45 +05:30
parent 5395b4853b
commit ab8f6a43ee
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 7794 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -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")
)
}
}
} }