Skip to content

Commit

Permalink
accounts/keystore: add test case for prefix bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Jan 23, 2025
1 parent 13276e0 commit de5333c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions accounts/keystore/keystore_plain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,25 @@ func TestKeyForDirectICAP(t *testing.T) {
}
}

func TestNewKeyForDirectICAP(t *testing.T) {
addr0 := common.HexToAddress("0x00ffffffffffffffffffffffffffffffffffffff")
addr1 := common.HexToAddress("0xffffffffffffffffffffffffffffffffffffffff")
tests := []struct {
name string
result bool
}{
{"addresses start with 0", addr0[0] == 0},
{"addresses not start with 0", addr1[0] != 0},
{"addr0 starts with 0x00 or xdc00", strings.HasPrefix(addr0.Hex(), "0x00") || strings.HasPrefix(addr0.Hex(), "xdc00")},
{"addr1 not start with 0x00 or xdc00", !(strings.HasPrefix(addr1.Hex(), "0x00") && strings.HasPrefix(addr1.Hex(), "xdc00"))},
}
for _, tt := range tests {
if !tt.result {
t.Errorf("test %q failed\n", tt.name)
}
}
}

func TestV3_31_Byte_Key(t *testing.T) {
t.Skip("This test does not ")
t.Parallel()
Expand Down

0 comments on commit de5333c

Please sign in to comment.