unit tests updated

pull/563/head
aniket-engg 4 years ago committed by Aniket
parent d5ea5bbf00
commit 62393c301e
  1. 9
      libs/remix-debug/test/debugger.js
  2. 4
      libs/remix-debug/test/decoder/contracts/byteStorage.js
  3. 8
      libs/remix-debug/test/decoder/localsTests/misc.js
  4. 2
      libs/remix-debug/test/decoder/storageDecoder.js

@ -258,13 +258,12 @@ function testDebugging (debugManager) {
tape('traceManager.decodeLocalsAt', async (t) => {
t.plan(1)
const tested = JSON.parse('{"proposalNames":{"value":[{"value":"0x48656C6C6F20576F726C64210000000000000000000000000000000000000000","type":"bytes32"}],"length":"0x1","type":"bytes32[]","cursor":1,"hasNext":false}}')
const tested = JSON.parse('{"proposalNames":{"value":[{"value":"0x48656C6C6F20576F726C64210000000000000000000000000000000000000000","type":"bytes32"}],"length":"0x1","type":"bytes32[]","cursor":1,"hasNext":false},"p":{"value":"45","type":"uint256"},"addressLocal":{"value":"0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB","type":"address"},"i":{"value":"2","type":"uint256"},"proposalsLocals":{"value":[{"value":{"name":{"value":"0x48656C6C6F20576F726C64210000000000000000000000000000000000000000","type":"bytes32"},"voteCount":{"value":"0","type":"uint256"}},"type":"struct Ballot.Proposal"}],"length":"0x1","type":"struct Ballot.Proposal[]"}}')
try {
const address = debugManager.traceManager.getCurrentCalledAddressAt(330)
const location = await debugManager.sourceLocationFromVMTraceIndex(address, 330)
debugManager.decodeLocalsAt(330, location, (error, decodedlocals) => {
const address = debugManager.traceManager.getCurrentCalledAddressAt(327)
const location = await debugManager.sourceLocationFromVMTraceIndex(address, 327)
debugManager.decodeLocalsAt(327, location, (error, decodedlocals) => {
if (error) return t.end(error)
t.ok(deepequal(decodedlocals, tested), `locals does not match. expected: ${JSON.stringify(tested)} - current: ${decodedlocals}`)
})
} catch (error) {

@ -44,7 +44,7 @@ module.exports = {
bytes32 stab32 = hex"324324423432543543AB";
enum1 enumDec = enum1.e240;
string str1 = 'short';
string str12 = 'short2';
string str12 = unicode'шеллы';
string str2 = 'long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long';
}
`,
@ -74,7 +74,7 @@ module.exports = {
'0x0000000000000000000000000000000000000000000000000000000000000016': '0x324324423432543543ab00000000000000000000000000000000000000000000',
'0x0000000000000000000000000000000000000000000000000000000000000017': '0x00000000000000000000000000000000000000000000000000000000000000f0',
'0x0000000000000000000000000000000000000000000000000000000000000018': '0x73686f727400000000000000000000000000000000000000000000000000000a',
'0x0000000000000000000000000000000000000000000000000000000000000019': '0x73686f7274320000000000000000000000000000000000000000000000000014',
'0x0000000000000000000000000000000000000000000000000000000000000019': '0xd188d0b5d0bbd0bbd18b00000000000000000000000000000000000000000014',
'0x000000000000000000000000000000000000000000000000000000000000001a': '0x000000000000000000000000000000000000000000000000000000000000023d',
'0x057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e': '0x6c6f6e675f5f6c6f6e675f5f6c6f6e675f5f6c6f6e675f5f6c6f6e675f5f6c6f',
'0x057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63f': '0x6e675f5f6c6f6e675f5f6c6f6e675f5f6c6f6e675f5f6c6f6e675f5f6c6f6e67',

@ -30,7 +30,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.fail(error)
})
callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
helper.decodeLocals(st, 73, traceManager, callTree, function (locals) {
helper.decodeLocals(st, 70, traceManager, callTree, function (locals) {
try {
st.equals(locals['boolFalse'].value, false)
st.equals(locals['boolTrue'].value, true)
@ -46,9 +46,9 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.equals(locals['__bytes9'].value, '0x99156744AF00000000')
st.equals(locals['__bytes13'].value, '0x99123423425300000000000000')
st.equals(locals['__bytes16'].value, '0x99AFAD23432400000000000000000000')
// st.equals(locals['__bytes24'].value, '0x99AFAD234324000000000000000000000000000000000000')
// st.equals(locals['__bytes32'].value, '0x9999ABD41799ABD4170000000000000000000000000000000000000000000000')
st.equals(Object.keys(locals).length, 14)
st.equals(locals['__bytes24'].value, '0x99AFAD234324000000000000000000000000000000000000')
st.equals(locals['__bytes32'].value, '0x9999ABD41799ABD4170000000000000000000000000000000000000000000000')
st.equals(Object.keys(locals).length, 16)
} catch (e) {
st.fail(e.message)
}

@ -115,6 +115,7 @@ function testByteStorage (st, cb) {
st.equal(decoded['stab32'].value, '0x324324423432543543AB00000000000000000000000000000000000000000000')
st.equal(decoded['enumDec'].value, 'e240')
st.equal(decoded['str1'].value, 'short')
st.equal(decoded['str12'].value, 'шеллы')
st.equal(decoded['str2'].value, 'long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long__long')
})
}
@ -163,6 +164,7 @@ function testByteStorage (st, cb) {
st.equal(decoded['str1'].length, '0x0')
st.equal(decoded['str2'].length, '0x0')
st.equal(decoded['str1'].value, '')
st.equal(decoded['str12'].value, '')
st.equal(decoded['str2'].value, '')
cb()
})

Loading…
Cancel
Save