-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgroup_test.go
More file actions
91 lines (81 loc) · 1.03 KB
/
Copy pathgroup_test.go
File metadata and controls
91 lines (81 loc) · 1.03 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package srp_test
import (
"encoding/hex"
"testing"
"github.com/bodgit/srp"
"github.com/bodgit/srp/internal/rfc5054"
"github.com/bodgit/srp/internal/util"
"github.com/stretchr/testify/assert"
)
func TestNewGroup(t *testing.T) {
t.Parallel()
tables := []struct {
g int64
size int
s string
err error
}{
{
2,
1024,
rfc5054.Hex1024,
nil,
},
{
2,
1024,
"0",
hex.ErrLength,
},
}
for _, table := range tables {
_, err := srp.NewGroup(table.g, table.size, table.s)
assert.ErrorIs(t, err, table.err)
}
}
func TestGetGroup(t *testing.T) {
t.Parallel()
tables := []struct {
group int
err error
}{
{
1024,
nil,
},
{
1536,
nil,
},
{
2048,
nil,
},
{
3072,
nil,
},
{
4096,
nil,
},
{
6144,
nil,
},
{
8192,
nil,
},
{
23,
util.ErrGroupNotFound,
},
}
for _, table := range tables {
_, err := srp.GetGroup(table.group)
if table.err != nil && assert.Error(t, err) {
assert.ErrorIs(t, err, table.err)
}
}
}