github.com/annchain/OG@v0.0.9/og_interface/address_test.go (about)

     1  package og_interface
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestAddress20_BytesToAddress(t *testing.T) {
     9  	type args struct {
    10  		b []byte
    11  	}
    12  	tests := []struct {
    13  		name string
    14  		a    Address20
    15  		args args
    16  	}{
    17  		{name: "c1", a: Address20([20]byte{}), args: args{b: []byte{0x03, 0x44}}},
    18  	}
    19  	for _, tt := range tests {
    20  		t.Run(tt.name, func(t *testing.T) {
    21  			tt.a.FromBytes(tt.args.b)
    22  			tt.a[3] = 0x88
    23  			fmt.Printf("%+v", tt.a)
    24  		})
    25  	}
    26  }
    27  
    28  func TestAddress20_HexToAddress(t *testing.T) {
    29  	type args struct {
    30  		s string
    31  	}
    32  	tests := []struct {
    33  		name    string
    34  		a       Address20
    35  		args    args
    36  		wantErr bool
    37  	}{
    38  		// TODO: Add test cases.
    39  	}
    40  	for _, tt := range tests {
    41  		t.Run(tt.name, func(t *testing.T) {
    42  			if err := tt.a.FromHex(tt.args.s); (err != nil) != tt.wantErr {
    43  				t.Errorf("HexToAddress() error = %v, wantErr %v", err, tt.wantErr)
    44  			}
    45  		})
    46  	}
    47  }
    48  
    49  func TestAddress20_HexToAddressNoError(t *testing.T) {
    50  	type args struct {
    51  		s string
    52  	}
    53  	tests := []struct {
    54  		name string
    55  		a    Address20
    56  		args args
    57  	}{
    58  		// TODO: Add test cases.
    59  	}
    60  	for _, tt := range tests {
    61  		t.Run(tt.name, func(t *testing.T) {
    62  		})
    63  	}
    64  }