forked from cerc-io/plugeth
Merge pull request #1827 from Gustav-Simonsson/common_tests
tests: add test for StateTests/stCallCodes.json
This commit is contained in:
commit
e456f27795
6798
tests/files/StateTests/stCallCodes.json
Normal file
6798
tests/files/StateTests/stCallCodes.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -115,6 +115,13 @@ func TestCallCreateCallCode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCallCodes(t *testing.T) {
|
||||||
|
fn := filepath.Join(stateTestDir, "stCallCodes.json")
|
||||||
|
if err := RunStateTest(fn, StateSkipTests); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestMemory(t *testing.T) {
|
func TestMemory(t *testing.T) {
|
||||||
fn := filepath.Join(stateTestDir, "stMemoryTest.json")
|
fn := filepath.Join(stateTestDir, "stMemoryTest.json")
|
||||||
if err := RunStateTest(fn, StateSkipTests); err != nil {
|
if err := RunStateTest(fn, StateSkipTests); err != nil {
|
||||||
|
@ -128,6 +128,7 @@ func runStateTests(tests map[string]VmTest, skipTests []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//fmt.Println("StateTest name:", name)
|
||||||
if err := runStateTest(test); err != nil {
|
if err := runStateTest(test); err != nil {
|
||||||
return fmt.Errorf("%s: %s\n", name, err.Error())
|
return fmt.Errorf("%s: %s\n", name, err.Error())
|
||||||
}
|
}
|
||||||
@ -172,7 +173,7 @@ func runStateTest(test VmTest) error {
|
|||||||
|
|
||||||
ret, logs, _, _ = RunState(statedb, env, test.Transaction)
|
ret, logs, _, _ = RunState(statedb, env, test.Transaction)
|
||||||
|
|
||||||
// // Compare expected and actual return
|
// Compare expected and actual return
|
||||||
rexp := common.FromHex(test.Out)
|
rexp := common.FromHex(test.Out)
|
||||||
if bytes.Compare(rexp, ret) != 0 {
|
if bytes.Compare(rexp, ret) != 0 {
|
||||||
return fmt.Errorf("return failed. Expected %x, got %x\n", rexp, ret)
|
return fmt.Errorf("return failed. Expected %x, got %x\n", rexp, ret)
|
||||||
|
Loading…
Reference in New Issue
Block a user