diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-12-10 00:32:45 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2021-12-21 13:01:40 +0530 |
commit | ab8f6a43eefab012900edd1ad9dbefd9a49b7429 (patch) | |
tree | 60d80ba1cc6f56364e03f23e56b83dbc9b511d29 /passgen/diceware/src/test/kotlin | |
parent | 5395b4853bac4bc7f3683d1122dd9b234b6f4174 (diff) |
diceware: add default wordlist to exercise tests
Diffstat (limited to 'passgen/diceware/src/test/kotlin')
-rw-r--r-- | passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt b/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt index e60db38c..a1633c69 100644 --- a/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt +++ b/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt @@ -5,6 +5,7 @@ package dev.msfjarvis.aps.passgen.diceware +import java.io.InputStream import kotlin.test.Test import kotlin.test.assertEquals @@ -17,4 +18,21 @@ class WordListParserTest { assertEquals("abcde", parsedMap[11111]) 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") + ) + } + } } |