Add UTF-8 tests
This commit is contained in:
parent
359b774183
commit
ea6de3427d
|
@ -1,6 +1,11 @@
|
|||
import
|
||||
../zxcvbn
|
||||
|
||||
proc passwordEntropy(x: string): float =
|
||||
result = zxcvbn.passwordEntropy(x)
|
||||
echo x, " = ", result
|
||||
|
||||
# ASCII passwords:
|
||||
let
|
||||
a = passwordEntropy "a"
|
||||
cat = passwordEntropy "cat"
|
||||
|
@ -21,4 +26,18 @@ doAssert remixedQwerty > cat
|
|||
doAssert remixedQwerty > a
|
||||
doAssert remixedQwerty > longRepeatingSequence
|
||||
|
||||
# UTF-8 Passwords:
|
||||
let
|
||||
bulgarianPassword = passwordEntropy("парола")
|
||||
bulgarianRepeatingSeq = passwordEntropy("яяяяяя")
|
||||
japanesePassword = passwordEntropy("パスワード")
|
||||
japaneseRepeatingSeq = passwordEntropy("パパパパパ")
|
||||
chinesePassword = passwordEntropy("密碼")
|
||||
chineseFourWords = passwordEntropy("正確的馬電池釘書釘")
|
||||
|
||||
doAssert bulgarianPassword > bulgarianRepeatingSeq
|
||||
doAssert japanesePassword > japaneseRepeatingSeq
|
||||
doAssert chineseFourWords > chinesePassword
|
||||
|
||||
echo "SUCCESS"
|
||||
|
||||
|
|
Loading…
Reference in New Issue