Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
5204a7da
Unverified
Commit
5204a7da
authored
Jun 29, 2024
by
Tien Nguyen
Committed by
GitHub
Jun 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-service: add unit test cover address.go file (#11049)
parent
b219b848
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
address_test.go
op-service/eth/address_test.go
+36
-0
No files found.
op-service/eth/address_test.go
0 → 100644
View file @
5204a7da
package
eth
import
(
"testing"
"github.com/ethereum/go-ethereum/common"
)
func
TestAddressAsLeftPaddedHash
(
t
*
testing
.
T
)
{
// Test cases with different addresses
testCases
:=
[]
struct
{
name
string
addr
common
.
Address
expect
common
.
Hash
}{
{
name
:
"empty address"
,
addr
:
common
.
Address
{},
expect
:
common
.
HexToHash
(
"0x0000000000000000000000000000000000000000"
),
},
{
name
:
"simple address"
,
addr
:
common
.
HexToAddress
(
"0x1234567890AbCdEf1234567890AbCdEf"
),
expect
:
common
.
HexToHash
(
"0x000000000000000000000000000000001234567890abcdef1234567890abcdef"
),
},
}
for
_
,
tc
:=
range
testCases
{
t
.
Run
(
tc
.
name
,
func
(
t
*
testing
.
T
)
{
output
:=
AddressAsLeftPaddedHash
(
tc
.
addr
)
if
output
!=
tc
.
expect
{
t
.
Fatalf
(
"Expected output %v for test case %s, got %v"
,
tc
.
expect
,
tc
.
name
,
output
)
}
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment