Fixed most of the tests

This commit is contained in:
obscuren
2014-10-16 18:27:05 +02:00
parent bb5038699e
commit 93fcabd251
9 changed files with 116 additions and 71 deletions

View File

@ -2,7 +2,6 @@ package ethvm
import (
"bytes"
"fmt"
"testing"
"github.com/ethereum/eth-go/ethstate"
@ -55,7 +54,7 @@ func RunVmTest(url string, t *testing.T) {
// When an error is returned it doesn't always mean the tests fails.
// Have to come up with some conditional failing mechanism.
if err != nil {
fmt.Println(err)
helper.Log.Infoln(err)
}
/*
if err != nil {
@ -80,7 +79,7 @@ func RunVmTest(url string, t *testing.T) {
vexp := helper.FromHex(value)
if bytes.Compare(v, vexp) != 0 {
t.Errorf("%s's : (%x: %s) storage failed. Expected %x, got %x\n", name, obj.Address()[0:4], addr, vexp, v)
t.Errorf("%s's : (%x: %s) storage failed. Expected %x, got %x (%v %v)\n", name, obj.Address()[0:4], addr, vexp, v, ethutil.BigD(vexp), ethutil.BigD(v))
}
}
}
@ -88,29 +87,49 @@ func RunVmTest(url string, t *testing.T) {
}
// I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail.
func TestVMSha3(t *testing.T) {
helper.Logger.SetLogLevel(0)
defer helper.Logger.SetLogLevel(4)
const url = "https://raw.githubusercontent.com/ethereum/tests/master/vmtests/vmSha3Test.json"
RunVmTest(url, t)
}
func TestVMArithmetic(t *testing.T) {
helper.Logger.SetLogLevel(0)
defer helper.Logger.SetLogLevel(4)
const url = "https://raw.githubusercontent.com/ethereum/tests/master/vmtests/vmArithmeticTest.json"
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmArithmeticTest.json"
RunVmTest(url, t)
}
func TestVMSystemOperations(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/master/vmtests/vmSystemOperationsTest.json"
func TestVMSystemOperation(t *testing.T) {
//helper.Logger.SetLogLevel(5)
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmSystemOperationsTest.json"
RunVmTest(url, t)
}
func TestOperations(t *testing.T) {
t.Skip()
const url = "https://raw.githubusercontent.com/ethereum/tests/master/vmtests/vmSystemOperationsTest.json"
func TestBitwiseLogicOperation(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmBitwiseLogicOperationTest.json"
RunVmTest(url, t)
}
func TestBlockInfo(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmBlockInfoTest.json"
RunVmTest(url, t)
}
func TestEnvironmentalInfo(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmEnvironmentalInfoTest.json"
RunVmTest(url, t)
}
func TestFlowOperation(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmIOandFlowOperationsTest.json"
RunVmTest(url, t)
}
func TestPushDupSwap(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmPushDupSwapTest.json"
RunVmTest(url, t)
}
func TestVMSha3(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmSha3Test.json"
RunVmTest(url, t)
}
func TestVm(t *testing.T) {
const url = "https://raw.githubusercontent.com/ethereum/tests/develop/vmtests/vmtests.json"
RunVmTest(url, t)
}