Merge pull request #1827 from Gustav-Simonsson/common_tests

tests: add test for StateTests/stCallCodes.json
This commit is contained in:
Jeffrey Wilcke 2015-09-23 02:12:59 -07:00
commit e456f27795
3 changed files with 6807 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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 {

View File

@ -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)