-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmisc_test.go
54 lines (42 loc) · 1.31 KB
/
misc_test.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
package libICP
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_Version(t *testing.T) {
assert.Equal(t, "0.1.0", Version())
}
func Test_NiceHex(t *testing.T) {
b := []byte{0xAA, 0xFF, 0x1E}
assert.Equal(t, "AA:FF:1E", nice_hex(b))
}
func Test_EncapsulatedContentInfo_AdjustForNoSigners(t *testing.T) {
ec := encapsulated_content_info{}
ec.AdjustForNoSigners()
assert.Equal(t, idData, ec.EContentType, "see RFC 5652 Section 5.2 Page 11 Paragraph 2")
assert.Nil(t, ec.EContent, "see RFC 5652 Section 5.2 Page 11 Paragraph 2")
}
func Test_IsZeroOfUnderlyingType_1(t *testing.T) {
assert.True(t, is_zero_of_underlying_type(0), "")
}
func Test_IsZeroOfUnderlyingType_2(t *testing.T) {
assert.False(t, is_zero_of_underlying_type(1), "")
}
func Test_IsZeroOfUnderlyingType_3(t *testing.T) {
var v []int
assert.True(t, is_zero_of_underlying_type(v), "")
}
func Test_IsZeroOfUnderlyingType_4(t *testing.T) {
var v []int
v = make([]int, 0)
assert.False(t, is_zero_of_underlying_type(v), "")
}
func Test_IsZeroOfUnderlyingType_5(t *testing.T) {
sd := signed_data_raw{}
assert.True(t, is_zero_of_underlying_type(sd), "")
}
func Test_IsZeroOfUnderlyingType_6(t *testing.T) {
sd := signed_data_raw{}
sd.EncapContentInfo.EContent = make([]byte, 0)
assert.False(t, is_zero_of_underlying_type(sd), "")
}