aboutsummaryrefslogtreecommitdiff
path: root/passgen/diceware/src/test/kotlin/dev
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-12-10 00:32:25 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-12-21 02:13:24 +0530
commit5395b4853bac4bc7f3683d1122dd9b234b6f4174 (patch)
tree038a6cf48e70ae0dd10f29180ad5f29dbc8ecda1 /passgen/diceware/src/test/kotlin/dev
parent16392b75814a71a4d78b3598cd3364baeb0b446e (diff)
diceware: add WordListParser and tests
Diffstat (limited to 'passgen/diceware/src/test/kotlin/dev')
-rw-r--r--passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt20
1 files changed, 20 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
new file mode 100644
index 00000000..e60db38c
--- /dev/null
+++ b/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt
@@ -0,0 +1,20 @@
+/*
+ * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+package dev.msfjarvis.aps.passgen.diceware
+
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class WordListParserTest {
+ @Test
+ fun parseWordList() {
+ val stream = "11111\tabcde\n22222\tfghij".byteInputStream()
+ val parsedMap = WordListParser.parse(stream)
+ assertEquals(2, parsedMap.size)
+ assertEquals("abcde", parsedMap[11111])
+ assertEquals("fghij", parsedMap[22222])
+ }
+}