-
Notifications
You must be signed in to change notification settings - Fork 199
/
suiteStub.go
71 lines (58 loc) · 1.49 KB
/
suiteStub.go
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
package mock
import (
"crypto/cipher"
"github.com/ElrondNetwork/elrond-go/crypto"
)
// SuiteMock -
type SuiteMock struct {
StringStub func() string
ScalarLenStub func() int
CreateScalarStub func() crypto.Scalar
PointLenStub func() int
CreatePointStub func() crypto.Point
CreatePointForScalarStub func(scalar crypto.Scalar) crypto.Point
RandomStreamStub func() cipher.Stream
GetUnderlyingSuiteStub func() interface{}
}
// GeneratorSuite -
type GeneratorSuite struct {
SuiteMock
CreateKeyStub func(cipher.Stream) crypto.Scalar
}
// String -
func (s *SuiteMock) String() string {
return s.StringStub()
}
// ScalarLen -
func (s *SuiteMock) ScalarLen() int {
return s.ScalarLenStub()
}
// CreateScalar -
func (s *SuiteMock) CreateScalar() crypto.Scalar {
return s.CreateScalarStub()
}
// PointLen -
func (s *SuiteMock) PointLen() int {
return s.PointLenStub()
}
// CreatePoint -
func (s *SuiteMock) CreatePoint() crypto.Point {
return s.CreatePointStub()
}
// RandomStream -
func (s *SuiteMock) RandomStream() cipher.Stream {
stream := NewStreamer()
return stream
}
// GetUnderlyingSuite -
func (s *SuiteMock) GetUnderlyingSuite() interface{} {
return s.GetUnderlyingSuiteStub()
}
// IsInterfaceNil returns true if there is no value under the interface
func (s *SuiteMock) IsInterfaceNil() bool {
return s == nil
}
// CreateKey -
func (gs *GeneratorSuite) CreateKey(c cipher.Stream) crypto.Scalar {
return gs.CreateKeyStub(c)
}