Commit eef41d5f authored by yann300's avatar yann300

add tests

parent b1f48bef
...@@ -32,7 +32,9 @@ function test (st, vm, privateKey) { ...@@ -32,7 +32,9 @@ function test (st, vm, privateKey) {
misc2LocalTest(st, vm, privateKey, output.contracts['test.sol']['miscLocal2'].evm.bytecode.object, output, function () { misc2LocalTest(st, vm, privateKey, output.contracts['test.sol']['miscLocal2'].evm.bytecode.object, output, function () {
output = compiler.compileStandardWrapper(compilerInput(structArrayLocal.contract)) output = compiler.compileStandardWrapper(compilerInput(structArrayLocal.contract))
output = JSON.parse(output) output = JSON.parse(output)
structArrayLocalTest(st, vm, privateKey, output.contracts['test.sol']['structArrayLocal'].evm.bytecode.object, output, function () {}) structArrayLocalTest(st, vm, privateKey, output.contracts['test.sol']['structArrayLocal'].evm.bytecode.object, output, function () {
st.end()
})
}) })
}) })
}) })
......
...@@ -17,12 +17,10 @@ module.exports = function testMappingStorage (st, cb) { ...@@ -17,12 +17,10 @@ module.exports = function testMappingStorage (st, cb) {
} else { } else {
remixLib.global.web3.eth.getTransaction(txHash, (error, tx) => { remixLib.global.web3.eth.getTransaction(txHash, (error, tx) => {
if (error) { if (error) {
console.log(error)
st.end(error) st.end(error)
} else { } else {
testMapping(st, vm, privateKey, tx.contractAddress, output, (error) => { testMapping(st, vm, privateKey, tx.contractAddress, output, cb)
st.end(error)
cb()
})
} }
}) })
} }
...@@ -39,6 +37,7 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) { ...@@ -39,6 +37,7 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) {
console.log(txHash) console.log(txHash)
remixLib.global.web3.eth.getTransaction(txHash, (error, tx) => { remixLib.global.web3.eth.getTransaction(txHash, (error, tx) => {
if (error) { if (error) {
console.log(error)
st.end(error) st.end(error)
} else { } else {
var TraceManager = require('remix-core').trace.TraceManager var TraceManager = require('remix-core').trace.TraceManager
...@@ -62,7 +61,7 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) { ...@@ -62,7 +61,7 @@ function testMapping (st, vm, privateKey, contractAddress, output, cb) {
st.equal(result['_iBreakSolidityStateInt'].type, 'mapping(uint256 => uint256)') st.equal(result['_iBreakSolidityStateInt'].type, 'mapping(uint256 => uint256)')
st.equal(result['_iBreakSolidityStateInt'].value['0000000000000000000000000000000000000000000000000000000000000001'].value, '1') st.equal(result['_iBreakSolidityStateInt'].value['0000000000000000000000000000000000000000000000000000000000000001'].value, '1')
st.equal(result['_iBreakSolidityStateInt'].value['0000000000000000000000000000000000000000000000000000000000000001'].type, 'uint256') st.equal(result['_iBreakSolidityStateInt'].value['0000000000000000000000000000000000000000000000000000000000000001'].type, 'uint256')
// st.end() cb()
}, (reason) => { }, (reason) => {
console.log('fail') console.log('fail')
st.end(reason) st.end(reason)
......
...@@ -3,6 +3,7 @@ var utileth = require('ethereumjs-util') ...@@ -3,6 +3,7 @@ var utileth = require('ethereumjs-util')
var Tx = require('ethereumjs-tx') var Tx = require('ethereumjs-tx')
var Block = require('ethereumjs-block') var Block = require('ethereumjs-block')
var BN = require('ethereumjs-util').BN var BN = require('ethereumjs-util').BN
var remixLib = require('remix-lib')
function sendTx (vm, from, to, value, data, cb) { function sendTx (vm, from, to, value, data, cb) {
var tx = new Tx({ var tx = new Tx({
...@@ -33,7 +34,6 @@ function sendTx (vm, from, to, value, data, cb) { ...@@ -33,7 +34,6 @@ function sendTx (vm, from, to, value, data, cb) {
Init VM / Send Transaction Init VM / Send Transaction
*/ */
function initVM (st, privateKey) { function initVM (st, privateKey) {
var remixLib = require('remix-lib')
var utileth = require('ethereumjs-util') var utileth = require('ethereumjs-util')
var VM = require('ethereumjs-vm') var VM = require('ethereumjs-vm')
var Web3Providers = remixLib.vm.Web3Providers var Web3Providers = remixLib.vm.Web3Providers
...@@ -52,7 +52,6 @@ function initVM (st, privateKey) { ...@@ -52,7 +52,6 @@ function initVM (st, privateKey) {
st.fail(mes) st.fail(mes)
} else { } else {
remixLib.global.web3 = obj remixLib.global.web3 = obj
st.end()
} }
}) })
return vm return vm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment