From ab8f6a43eefab012900edd1ad9dbefd9a49b7429 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 10 Dec 2021 00:32:45 +0530 Subject: diceware: add default wordlist to exercise tests --- .../aps/passgen/diceware/WordListParserTest.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'passgen/diceware/src/test/kotlin') 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") + ) + } + } } -- cgit v1.2.3