-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddress_test.go
57 lines (53 loc) · 1.1 KB
/
address_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
55
56
57
package ethutils
import (
"reflect"
"testing"
"github.com/ethereum/go-ethereum/common"
)
func TestHexToAddress(t *testing.T) {
type args struct {
hexAddress string
}
tests := []struct {
args args
want common.Address
}{
{
args: args{
hexAddress: "0xd1FB944748aca327a1ba036B082993D9dd9Bfa0C",
},
want: SarafuNetworkRegistry,
},
}
for _, tt := range tests {
t.Run("Hex2Address", func(t *testing.T) {
if got := HexToAddress(tt.args.hexAddress); !reflect.DeepEqual(got, tt.want) {
t.Errorf("HexToAddress() = %v, want %v", got, tt.want)
}
})
}
}
func TestChecksumAddress(t *testing.T) {
type args struct {
hexAddress string
}
tests := []struct {
args args
want common.Address
}{
{
args: args{
// mixedCase
hexAddress: "0xd1fb944748aca327a1ba036B082993D9dd9Bfa0C",
},
want: SarafuNetworkRegistry,
},
}
for _, tt := range tests {
t.Run("ChecksumAddress", func(t *testing.T) {
if got := HexToAddress(ChecksumAddress(tt.args.hexAddress)); !reflect.DeepEqual(got, tt.want) {
t.Errorf("ChecksumAddress() = %v, want %v", got, tt.want)
}
})
}
}