Add a basic fuzzing test
This commit is contained in:
parent
2c86512ffc
commit
fa8a40aaa2
|
@ -0,0 +1,12 @@
|
|||
import
|
||||
testutils/fuzzing,
|
||||
../zxcvbn
|
||||
|
||||
proc toString(data: openarray[byte]): string =
|
||||
result = newString(data.len)
|
||||
if data.len > 0:
|
||||
copyMem(addr result[0], unsafeAddr data[0], data.len)
|
||||
|
||||
test:
|
||||
let entropy = passwordEntropy(toString payload)
|
||||
|
|
@ -16,5 +16,9 @@ doAssert strongPassword > fourWords
|
|||
doAssert fourWords > remixedLongWord
|
||||
doAssert remixedLongWord > remixedQwerty
|
||||
doAssert remixedQwerty > abracadabra
|
||||
doAssert remixedQwerty > qwerty
|
||||
doAssert remixedQwerty > cat
|
||||
doAssert remixedQwerty > a
|
||||
doAssert remixedQwerty > longRepeatingSequence
|
||||
|
||||
echo "SUCCESS"
|
||||
|
|
Loading…
Reference in New Issue