slip-0039: add wordlist test

parent 52bb7c61
......@@ -89,9 +89,12 @@ No localization is supported. This standard deals with a set of English words on
Wordlist mandated by this SLIP is [available here](slip-0039/wordlist.txt). Several criteria were applied where creating the list:
* wordlist is alphabetically sorted
* wordlist contains only common English words
* no word is shorter than 4 letters and longer than 8 letters
* no word is shorter than 4 letters
* no word is longer than 8 letters
* all words have unique 4-letter prefix
* wordlist contains only common English words (+ the word "satoshi")
(see the [test](slip-0039/test_wordlist.sh) which checks whether these criteria are fulfilled).
## Test Vectors
......
#!/bin/bash
# wordlist is alphabetically sorted
diff wordlist.txt <(sort wordlist.txt) && echo OK
# no word is shorter than 4 letters
diff wordlist.txt <(grep '^....' wordlist.txt) && echo OK
# no word is longer than 8 letters
! grep -q '^.........' wordlist.txt && echo OK
# all words have unique 4-letter prefix
diff <(cut -c 1-4 wordlist.txt) <(cut -c 1-4 wordlist.txt | sort -u) && echo OK
# wordlist contains only common English words (+ the word "satoshi")
test "$(comm -23 wordlist.txt <(aspell -l en dump master | tr [A-Z] [a-z] | sort ))" = "satoshi" && echo OK
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment