Updated tests

This commit is contained in:
obscuren 2015-02-04 07:39:02 -08:00
parent 4dc283c0fb
commit 3f03197dae
8 changed files with 137 additions and 5 deletions

@ -1,4 +1,44 @@
{ {
"RefundOverflow" : {
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "45678256",
"currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
"currentNumber" : "0",
"currentTimestamp" : 1,
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"logs" : [
],
"out" : "0x",
"post" : {
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "400",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
}
},
"pre" : {
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
"balance" : "400",
"code" : "0x",
"nonce" : "0",
"storage" : {
}
}
},
"transaction" : {
"data" : "",
"gasLimit" : "5789604461865809771178549250434395392663499233282028201972879200395656482016",
"gasPrice" : "20",
"nonce" : "0",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value" : ""
}
},
"refund500" : { "refund500" : {
"env" : { "env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",

@ -0,0 +1,31 @@
{
"randomVMtest" : {
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
"currentGasLimit" : "1000000",
"currentNumber" : "300",
"currentTimestamp" : "2",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x404544420855",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x404544420855",
"nonce" : "0",
"storage" : {
}
}
}
}
}

@ -0,0 +1,59 @@
{
"randomVMtest" : {
"callcreates" : [
{
"data" : "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"destination" : "",
"gasLimit" : "9872",
"value" : "2"
},
{
"data" : "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"destination" : "",
"gasLimit" : "9770",
"value" : "9870"
}
],
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
"currentGasLimit" : "1000000",
"currentNumber" : "300",
"currentTimestamp" : "2",
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"caller" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"code" : "0x424443444243434383f0155af055",
"data" : "0x",
"gas" : "10000",
"gasPrice" : "100000000000000",
"origin" : "cd1722f3947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000"
},
"gas" : "9470",
"logs" : [
],
"out" : "0x",
"post" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "999999999999990128",
"code" : "0x424443444243434383f0155af055",
"nonce" : "0",
"storage" : {
"0x945304eb96065b2a98b57a48a06ae28d285a71b5" : "0x02"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"code" : "0x424443444243434383f0155af055",
"nonce" : "0",
"storage" : {
}
}
}
}
}

@ -1,8 +1,8 @@
var tests = module.exports = {}; var tests = module.exports = {};
Object.defineProperties(tests, { Object.defineProperties(tests, {
blockTests: { blockchainTests: {
get: require('require-all').bind(this, __dirname + '/BlockTests') get: require('require-all').bind(this, __dirname + '/BlockchainTests')
}, },
basicTests: { basicTests: {
get: require('require-all').bind(this, __dirname + '/BasicTests/') get: require('require-all').bind(this, __dirname + '/BasicTests/')

@ -1,6 +1,6 @@
{ {
"name": "ethereum-tests", "name": "ethereum-tests",
"version": "0.0.2", "version": "0.0.3",
"description": "tests for ethereum", "description": "tests for ethereum",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

@ -510,7 +510,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
case GASPRICE: case GASPRICE:
stack.Push(context.Price) stack.Push(context.Price)
self.Printf(" => %v", context.Price) self.Printf(" => %x", context.Price)
// 0x40 range // 0x40 range
case BLOCKHASH: case BLOCKHASH:
@ -643,6 +643,8 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
stack.Push(big.NewInt(int64(mem.Len()))) stack.Push(big.NewInt(int64(mem.Len())))
case GAS: case GAS:
stack.Push(context.Gas) stack.Push(context.Gas)
self.Printf(" => %x", context.Gas)
// 0x60 range // 0x60 range
case CREATE: case CREATE:
@ -653,6 +655,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
gas = new(big.Int).Set(context.Gas) gas = new(big.Int).Set(context.Gas)
addr []byte addr []byte
) )
self.Endl()
context.UseGas(context.Gas) context.UseGas(context.Gas)
ret, suberr, ref := self.env.Create(context, nil, input, gas, price, value) ret, suberr, ref := self.env.Create(context, nil, input, gas, price, value)
@ -673,7 +676,6 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
stack.Push(ethutil.BigD(addr)) stack.Push(ethutil.BigD(addr))
self.Printf(" (*) %x", addr)
} }
// Debug hook // Debug hook