pull/7/head
yann300 8 years ago
parent 84dc68463c
commit 6041a79b06
  1. 8
      test/solidity/localDecoder.js
  2. 23
      test/solidity/localsTests/int.js
  3. 2
      test/solidity/localsTests/misc.js
  4. 2
      test/solidity/localsTests/misc2.js
  5. 2
      test/solidity/localsTests/structArray.js
  6. 4
      test/sourceMappingDecoder.js

@ -48,13 +48,13 @@ function initVM (st, address) {
function test (st, vm, privateKey) {
var output = compiler.compile(intLocal.contract, 0)
intLocalTest(st, vm, privateKey, output.contracts['intLocal'].bytecode, output, function () {
intLocalTest(st, vm, privateKey, output.contracts[':intLocal'].bytecode, output, function () {
output = compiler.compile(miscLocal.contract, 0)
miscLocalTest(st, vm, privateKey, output.contracts['miscLocal'].bytecode, output, function () {
miscLocalTest(st, vm, privateKey, output.contracts[':miscLocal'].bytecode, output, function () {
output = compiler.compile(miscLocal.contract, 0)
misc2LocalTest(st, vm, privateKey, output.contracts['miscLocal2'].bytecode, output, function () {
misc2LocalTest(st, vm, privateKey, output.contracts[':miscLocal2'].bytecode, output, function () {
output = compiler.compile(structArrayLocal.contract, 0)
structArrayLocalTest(st, vm, privateKey, output.contracts['structArrayLocal'].bytecode, output, function () {})
structArrayLocalTest(st, vm, privateKey, output.contracts[':structArrayLocal'].bytecode, output, function () {})
})
})
})

@ -32,11 +32,12 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
try {
st.equals(scopeStarts[0], '')
st.equals(scopeStarts[97], '1')
st.equals(scopeStarts[112], '1.1')
st.equals(scopeStarts[135], '2')
st.equals(scopeStarts[154], '3')
st.equals(scopeStarts[169], '3.1')
st.equals(scopeStarts[12], '1')
st.equals(scopeStarts[106], '2')
st.equals(scopeStarts[121], '2.1')
st.equals(scopeStarts[144], '3')
st.equals(scopeStarts[163], '4')
st.equals(scopeStarts[178], '4.1')
st.equals(scopes[''].locals['ui8'].type.typeName, 'uint8')
st.equals(scopes[''].locals['ui16'].type.typeName, 'uint16')
st.equals(scopes[''].locals['ui32'].type.typeName, 'uint32')
@ -52,16 +53,16 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.equals(scopes[''].locals['i256'].type.typeName, 'int256')
st.equals(scopes[''].locals['i'].type.typeName, 'int256')
st.equals(scopes[''].locals['ishrink'].type.typeName, 'int32')
st.equals(scopes['1'].locals['ui8'].type.typeName, 'uint8')
st.equals(scopes['1.1'].locals['ui81'].type.typeName, 'uint8')
st.equals(scopes['2'].locals['ui81'].type.typeName, 'uint8')
st.equals(scopes['3'].locals['ui8'].type.typeName, 'uint8')
st.equals(scopes['3.1'].locals['ui81'].type.typeName, 'uint8')
st.equals(scopes['2'].locals['ui8'].type.typeName, 'uint8')
st.equals(scopes['2.1'].locals['ui81'].type.typeName, 'uint8')
st.equals(scopes['3'].locals['ui81'].type.typeName, 'uint8')
st.equals(scopes['4'].locals['ui8'].type.typeName, 'uint8')
st.equals(scopes['4.1'].locals['ui81'].type.typeName, 'uint8')
} catch (e) {
st.fail(e.message)
}
helper.decodeLocals(st, 125, traceManager, callTree, function (locals) {
helper.decodeLocals(st, 95, traceManager, callTree, function (locals) {
st.equals(Object.keys(locals).length, 16)
st.equals(locals['ui8'].value, '130')
st.equals(locals['ui16'].value, '456')

@ -30,7 +30,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.fail(error)
})
callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
helper.decodeLocals(st, 70, traceManager, callTree, function (locals) {
helper.decodeLocals(st, 72, traceManager, callTree, function (locals) {
try {
st.equals(locals['boolFalse'].value, false)
st.equals(locals['boolTrue'].value, true)

@ -30,7 +30,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.fail(error)
})
callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
helper.decodeLocals(st, 72, traceManager, callTree, function (locals) {
helper.decodeLocals(st, 96, traceManager, callTree, function (locals) {
try {
st.equals(locals['dynbytes'].value, '0x64796e616d69636279746573')
st.equals(locals['smallstring'].value, 'test_test_test')

@ -30,7 +30,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.fail(error)
})
callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
helper.decodeLocals(st, 1814, traceManager, callTree, function (locals) {
helper.decodeLocals(st, 2094, traceManager, callTree, function (locals) {
try {
st.equals(locals['bytesSimple'].length, '0x14')
st.equals(locals['bytesSimple'].value, '0x746573745f7375706572')

@ -7,9 +7,9 @@ tape('SourceMappingDecoder', function (t) {
t.test('SourceMappingDecoder.findNodeAtInstructionIndex', function (st) {
var output = compiler.compile(contracts, 0)
var sourceMappingDecoder = new SourceMappingDecoder()
var node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 2, output.contracts['test'].srcmapRuntime, output.sources[''])
var node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 2, output.contracts[':test'].srcmapRuntime, output.sources[''])
st.equal(node, null)
node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 37, output.contracts['test'].srcmapRuntime, output.sources[''])
node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 37, output.contracts[':test'].srcmapRuntime, output.sources[''])
st.notEqual(node, null)
if (node) {
st.equal(node.attributes.name, 'f1')

Loading…
Cancel
Save