Skip to content

Commit

Permalink
core/vm: replace repeated string with variable in tests (ethereum#22774)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbuchwald authored and atif-konasl committed Oct 15, 2021
1 parent 12794bb commit 54c8a61
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions core/vm/instructions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type twoOperandParams struct {
y string
}

var alphabetSoup = "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
var commonParams []*twoOperandParams
var twoOpMethods map[string]executionFunc

Expand Down Expand Up @@ -347,8 +348,8 @@ func BenchmarkOpSub256(b *testing.B) {
}

func BenchmarkOpMul(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opMul, x, y)
}
Expand Down Expand Up @@ -379,64 +380,64 @@ func BenchmarkOpSdiv(b *testing.B) {
}

func BenchmarkOpMod(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opMod, x, y)
}

func BenchmarkOpSmod(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opSmod, x, y)
}

func BenchmarkOpExp(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opExp, x, y)
}

func BenchmarkOpSignExtend(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opSignExtend, x, y)
}

func BenchmarkOpLt(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opLt, x, y)
}

func BenchmarkOpGt(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opGt, x, y)
}

func BenchmarkOpSlt(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opSlt, x, y)
}

func BenchmarkOpSgt(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opSgt, x, y)
}

func BenchmarkOpEq(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opEq, x, y)
}
Expand All @@ -446,45 +447,45 @@ func BenchmarkOpEq2(b *testing.B) {
opBenchmark(b, opEq, x, y)
}
func BenchmarkOpAnd(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opAnd, x, y)
}

func BenchmarkOpOr(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opOr, x, y)
}

func BenchmarkOpXor(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opXor, x, y)
}

func BenchmarkOpByte(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup

opBenchmark(b, opByte, x, y)
}

func BenchmarkOpAddmod(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
z := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup
z := alphabetSoup

opBenchmark(b, opAddmod, x, y, z)
}

func BenchmarkOpMulmod(b *testing.B) {
x := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
y := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
z := "ABCDEF090807060504030201ffffffffffffffffffffffffffffffffffffffff"
x := alphabetSoup
y := alphabetSoup
z := alphabetSoup

opBenchmark(b, opMulmod, x, y, z)
}
Expand Down

0 comments on commit 54c8a61

Please sign in to comment.