Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
c0062617
Unverified
Commit
c0062617
authored
Jan 11, 2022
by
rangzen
Committed by
GitHub
Jan 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth: add tests for version_check (#24169)
parent
e6b61edd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
version_check_test.go
cmd/geth/version_check_test.go
+38
-0
No files found.
cmd/geth/version_check_test.go
View file @
c0062617
...
@@ -25,6 +25,8 @@ import (
...
@@ -25,6 +25,8 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"testing"
"testing"
"github.com/jedisct1/go-minisign"
)
)
func
TestVerification
(
t
*
testing
.
T
)
{
func
TestVerification
(
t
*
testing
.
T
)
{
...
@@ -128,3 +130,39 @@ func TestMatching(t *testing.T) {
...
@@ -128,3 +130,39 @@ func TestMatching(t *testing.T) {
}
}
}
}
}
}
func
TestGethPubKeysParseable
(
t
*
testing
.
T
)
{
for
_
,
pubkey
:=
range
gethPubKeys
{
_
,
err
:=
minisign
.
NewPublicKey
(
pubkey
)
if
err
!=
nil
{
t
.
Errorf
(
"Should be parseable"
)
}
}
}
func
TestKeyID
(
t
*
testing
.
T
)
{
type
args
struct
{
id
[
8
]
byte
}
tests
:=
[]
struct
{
name
string
args
args
want
string
}{
{
"@holiman key"
,
args
{
id
:
extractKeyId
(
gethPubKeys
[
0
])},
"FB1D084D39BAEC24"
},
{
"second key"
,
args
{
id
:
extractKeyId
(
gethPubKeys
[
1
])},
"138B1CA303E51687"
},
{
"third key"
,
args
{
id
:
extractKeyId
(
gethPubKeys
[
2
])},
"FD9813B2D2098484"
},
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
got
:=
keyID
(
tt
.
args
.
id
);
got
!=
tt
.
want
{
t
.
Errorf
(
"keyID() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
extractKeyId
(
pubkey
string
)
[
8
]
byte
{
p
,
_
:=
minisign
.
NewPublicKey
(
pubkey
)
return
p
.
KeyId
}
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