You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.3 KiB
105 lines
2.3 KiB
package tron
|
|
|
|
import (
|
|
"crypto/ecdsa"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestTronWalletAddress(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
want string
|
|
want1 string
|
|
wantErr bool
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, got1, err := TronWalletAddress()
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("TronWalletAddress() error = %v, wantErr %v", err, tt.wantErr)
|
|
return
|
|
}
|
|
if got != tt.want {
|
|
t.Errorf("TronWalletAddress() got = %v, want %v", got, tt.want)
|
|
}
|
|
if got1 != tt.want1 {
|
|
t.Errorf("TronWalletAddress() got1 = %v, want %v", got1, tt.want1)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_generateKeyPair(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
wantB5 string
|
|
wantPk string
|
|
wantErr bool
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
gotB5, gotPk, err := generateKeyPair()
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("generateKeyPair() error = %v, wantErr %v", err, tt.wantErr)
|
|
return
|
|
}
|
|
if gotB5 != tt.wantB5 {
|
|
t.Errorf("generateKeyPair() gotB5 = %v, want %v", gotB5, tt.wantB5)
|
|
}
|
|
if gotPk != tt.wantPk {
|
|
t.Errorf("generateKeyPair() gotPk = %v, want %v", gotPk, tt.wantPk)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_tornPrivateKey(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
want *ecdsa.PrivateKey
|
|
want1 []byte
|
|
wantErr bool
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, got1, err := tornPrivateKey()
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("tornPrivateKey() error = %v, wantErr %v", err, tt.wantErr)
|
|
return
|
|
}
|
|
if !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("tornPrivateKey() got = %v, want %v", got, tt.want)
|
|
}
|
|
if !reflect.DeepEqual(got1, tt.want1) {
|
|
t.Errorf("tornPrivateKey() got1 = %v, want %v", got1, tt.want1)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_tornPublicKey(t *testing.T) {
|
|
type args struct {
|
|
privateKey *ecdsa.PrivateKey
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want *ecdsa.PublicKey
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := tornPublicKey(tt.args.privateKey); !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("tornPublicKey() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|