Add a basic fuzzing test

This commit is contained in:
Zahary Karadjov 2020-10-07 15:43:59 +03:00
parent 2c86512ffc
commit fa8a40aaa2
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
2 changed files with 16 additions and 0 deletions

12
tests/fuzzing_test.nim Normal file
View File

@ -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)

View File

@ -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"