Remove more words and remove duplicates
This commit is contained in:
parent
3b77a01dad
commit
b2ebf2cc5d
1533
utils/clean-words.go
1533
utils/clean-words.go
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,21 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_Passphrase(t *testing.T) {
|
func Test_onlyUniqueWords(t *testing.T) {
|
||||||
for run := range 100 {
|
wordsDistribution := make(map[string]int)
|
||||||
phrase := NewPassphrase()
|
|
||||||
fmt.Println(run, ": ", phrase)
|
for _, word := range CleanWords {
|
||||||
assert.NotEmpty(t, phrase)
|
wordsDistribution[word] += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, v := range wordsDistribution {
|
||||||
|
assert.Equal(t, 1, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, numberOfCleanWords, len(wordsDistribution))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user