mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
cmd/eofdump: regenerate testdata
This commit is contained in:
parent
5a1acc4a07
commit
61d8f53934
3 changed files with 89 additions and 77 deletions
|
|
@ -94,6 +94,7 @@ func testEofParse(t *testing.T, isInitCode bool, wantFile string) {
|
||||||
t.Logf("# Reading seed data from %v", fname)
|
t.Logf("# Reading seed data from %v", fname)
|
||||||
scanner := bufio.NewScanner(corpus)
|
scanner := bufio.NewScanner(corpus)
|
||||||
scanner.Buffer(make([]byte, 1024), 10*1024*1024)
|
scanner.Buffer(make([]byte, 1024), 10*1024*1024)
|
||||||
|
line := 1
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
s := scanner.Text()
|
s := scanner.Text()
|
||||||
if len(s) >= 2 && strings.HasPrefix(s, "0x") {
|
if len(s) >= 2 && strings.HasPrefix(s, "0x") {
|
||||||
|
|
@ -104,11 +105,22 @@ func testEofParse(t *testing.T, isInitCode bool, wantFile string) {
|
||||||
panic(err) // rotten corpus
|
panic(err) // rotten corpus
|
||||||
}
|
}
|
||||||
have := parse(b, isInitCode)
|
have := parse(b, isInitCode)
|
||||||
|
if false { // Change this to generate the want-output
|
||||||
|
fmt.Printf("%v\n", have)
|
||||||
|
} else {
|
||||||
want := wantFn()
|
want := wantFn()
|
||||||
if have != want {
|
if have != want {
|
||||||
t.Fatalf("input %x, isInit: %v \nhave: %q\nwant: %q\n",
|
if len(want) > 100 {
|
||||||
b, isInitCode, have, want)
|
want = want[:100]
|
||||||
}
|
}
|
||||||
|
if len(b) > 100 {
|
||||||
|
b = b[:100]
|
||||||
|
}
|
||||||
|
t.Fatalf("%v:%d\ninput %x\nisInit: %v\nhave: %q\nwant: %q\n",
|
||||||
|
fname, line, b, isInitCode, have, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
line++
|
||||||
|
|
||||||
}
|
}
|
||||||
corpus.Close()
|
corpus.Close()
|
||||||
|
|
|
||||||
84
cmd/eofdump/testdata/results.initcode.txt
vendored
84
cmd/eofdump/testdata/results.initcode.txt
vendored
File diff suppressed because one or more lines are too long
62
cmd/eofdump/testdata/results.regular.txt
vendored
62
cmd/eofdump/testdata/results.regular.txt
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue