-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiceware_test.go
More file actions
41 lines (34 loc) · 767 Bytes
/
Copy pathdiceware_test.go
File metadata and controls
41 lines (34 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package diceware
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLarge(t *testing.T) {
w, err := Pick(LargeList)
require.NoError(t, err)
require.NotEmpty(t, w)
}
func TestShortList(t *testing.T) {
w, err := Pick(ShortList)
require.NoError(t, err)
require.NotEmpty(t, w)
}
func TestShortList2(t *testing.T) {
w, err := Pick(ShortList2)
require.NoError(t, err)
require.NotEmpty(t, w)
}
func TestPassphrase(t *testing.T) {
phrase, err := Passphrase(4, ShortList2)
require.NoError(t, err)
require.NotEmpty(t, phrase)
chunks := strings.Split(phrase, " ")
assert.Equal(t, 4, len(chunks))
}
func BenchmarkPickLarge(b *testing.B) {
for i := 0; i < b.N; i++ {
Pick(LargeList)
}
}