Merge pull request #179 from ethereum/treeView

Treeview - Add solidity type
pull/7/head
chriseth 8 years ago committed by GitHub
commit 7a434782be
  1. 2
      src/solidity/decodeInfo.js
  2. 3
      src/solidity/localDecoder.js
  3. 12
      src/solidity/types/ArrayType.js
  4. 6
      src/solidity/types/DynamicByteArray.js
  5. 2
      src/solidity/types/FixedByteArray.js
  6. 2
      src/solidity/types/Int.js
  7. 10
      src/solidity/types/RefType.js
  8. 3
      src/solidity/types/StringType.js
  9. 14
      src/solidity/types/Struct.js
  10. 2
      src/solidity/types/Uint.js
  11. 19
      src/solidity/types/ValueType.js
  12. 55
      src/ui/ASMCode.js
  13. 8
      src/ui/DropdownPanel.js
  14. 27
      src/ui/SolidityLocals.js
  15. 21
      src/ui/SolidityState.js
  16. 66
      src/ui/SolidityTypeFormatter.js
  17. 56
      src/ui/TreeView.js
  18. 4
      src/ui/styles/basicStyles.js
  19. 7
      src/ui/styles/dropdownPanel.js
  20. 17
      src/ui/styles/treeView.js
  21. 4
      test-browser/init.js
  22. 40
      test/solidity/decodeInfo.js
  23. 72
      test/solidity/localsTests/int.js
  24. 64
      test/solidity/localsTests/misc.js
  25. 94
      test/solidity/localsTests/structArray.js
  26. 356
      test/solidity/storageDecoder.js

@ -181,7 +181,7 @@ function struct (type, stateDefinitions, contractName, location) {
}
var memberDetails = getStructMembers(match[1], stateDefinitions, contractName, location) // type is used to extract the ast struct definition
if (!memberDetails) return null
return new StructType(memberDetails, location)
return new StructType(memberDetails, location, match[1])
} else {
return null
}

@ -3,7 +3,8 @@
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
var scope = internalTreeCall.findScope(vmtraceIndex)
if (!scope) {
return { 'error': 'Can\'t display locals. reason: compilation result might not have been provided' }
var error = { 'message': 'Can\'t display locals. reason: compilation result might not have been provided' }
throw error
}
var locals = {}
memory = formatMemory(memory)

@ -17,7 +17,8 @@ class ArrayType extends RefType {
storageSlots = arraySize * underlyingType.storageSlots
}
}
super(storageSlots, 32, 'array', location)
var size = arraySize !== 'dynamic' ? arraySize : ''
super(storageSlots, 32, underlyingType.typeName + '[' + size + ']', location)
this.underlyingType = underlyingType
this.arraySize = arraySize
}
@ -52,7 +53,8 @@ class ArrayType extends RefType {
}
return {
value: ret,
length: '0x' + size.toString(16)
length: '0x' + size.toString(16),
type: this.typeName
}
}
@ -69,7 +71,11 @@ class ArrayType extends RefType {
ret.push(this.underlyingType.decodeFromMemory(contentOffset, memory))
offset += 32
}
return ret
return {
value: ret,
length: '0x' + length.toString(16),
type: this.typeName
}
}
}

@ -30,7 +30,8 @@ class DynamicByteArray extends RefType {
var size = parseInt(value.substr(value.length - 2, 2), 16) / 2
return {
value: '0x' + value.substr(0, size * 2),
length: '0x' + size.toString(16)
length: '0x' + size.toString(16),
type: this.typeName
}
}
}
@ -41,7 +42,8 @@ class DynamicByteArray extends RefType {
length = 2 * parseInt(length, 16)
return {
length: '0x' + length.toString(16),
value: '0x' + memory.substr(offset + 64, length)
value: '0x' + memory.substr(offset + 64, length),
type: this.typeName
}
}
}

@ -3,7 +3,7 @@ var ValueType = require('./ValueType')
class FixedByteArray extends ValueType {
constructor (storageBytes) {
super(1, storageBytes, 'bytesX')
super(1, storageBytes, 'bytes' + storageBytes)
}
decodeValue (value) {

@ -4,7 +4,7 @@ var ValueType = require('./ValueType')
class Int extends ValueType {
constructor (storageBytes) {
super(1, storageBytes, 'int')
super(1, storageBytes, 'int' + storageBytes * 8)
}
decodeValue (value) {

@ -20,7 +20,10 @@ class RefType {
*/
decodeFromStack (stackDepth, stack, memory, storage) {
if (stack.length - 1 < stackDepth) {
return { error: '<decoding failed - stack underflow ' + stackDepth + '>' }
return {
error: '<decoding failed - stack underflow ' + stackDepth + '>',
type: this.typeName
}
}
if (!storage) {
storage = {} // TODO this is a fallback, should manage properly locals store in storage
@ -32,7 +35,10 @@ class RefType {
} else if (this.isInMemory()) {
return this.decodeFromMemoryInternal(offset, memory)
} else {
return { error: '<decoding failed - no decoder for ' + this.location + '>' }
return {
error: '<decoding failed - no decoder for ' + this.location + '>',
type: this.typeName
}
}
}

@ -30,7 +30,8 @@ function format (decoded) {
value = value.replace('0x', '').replace(/(..)/g, '%$1')
var ret = {
length: decoded.length,
raw: decoded.value
raw: decoded.value,
type: 'string'
}
try {
ret.value = decodeURIComponent(value)

@ -3,8 +3,8 @@ var util = require('./util')
var RefType = require('./RefType')
class Struct extends RefType {
constructor (memberDetails, location) {
super(memberDetails.storageSlots, 32, 'struct', location)
constructor (memberDetails, location, fullType) {
super(memberDetails.storageSlots, 32, 'struct ' + fullType, location)
this.members = memberDetails.members
}
@ -17,7 +17,10 @@ class Struct extends RefType {
}
ret[item.name] = item.type.decodeFromStorage(globalLocation, storageContent)
})
return ret
return {
value: ret,
type: this.typeName
}
}
decodeFromMemoryInternal (offset, memory) {
@ -28,7 +31,10 @@ class Struct extends RefType {
ret[item.name] = member
offset += 32
})
return ret
return {
value: ret,
type: this.typeName
}
}
}

@ -4,7 +4,7 @@ var ValueType = require('./ValueType')
class Uint extends ValueType {
constructor (storageBytes) {
super(1, storageBytes, 'uint')
super(1, storageBytes, 'uint' + storageBytes * 8)
}
decodeValue (value) {

@ -18,7 +18,10 @@ class ValueType {
*/
decodeFromStorage (location, storageContent) {
var value = util.extractHexValue(location, storageContent, this.storageBytes)
return this.decodeValue(value)
return {
value: this.decodeValue(value),
type: this.typeName
}
}
/**
@ -30,10 +33,15 @@ class ValueType {
* @return {Object} - decoded value
*/
decodeFromStack (stackDepth, stack, memory) {
var value
if (stackDepth >= stack.length) {
return this.decodeValue('')
value = this.decodeValue('')
} else {
return this.decodeValue(stack[stack.length - 1 - stackDepth].replace('0x', ''))
value = this.decodeValue(stack[stack.length - 1 - stackDepth].replace('0x', ''))
}
return {
value: value,
type: this.typeName
}
}
@ -46,7 +54,10 @@ class ValueType {
*/
decodeFromMemory (offset, memory) {
var value = memory.substr(2 * offset, 64)
return this.decodeValue(util.extractHexByteSlice(value, this.storageBytes, 0))
return {
value: this.decodeValue(util.extractHexByteSlice(value, this.storageBytes, 0)),
type: this.typeName
}
}
}

@ -1,55 +0,0 @@
'use strict'
var style = require('./styles/basicStyles')
var yo = require('yo-yo')
var ui = require('../helpers/ui')
function ASMCode (_parent, _codeManager) {
this.parent = _parent
this.codeManager = _codeManager
this.code
this.address
this.codeView
this.init()
}
ASMCode.prototype.render = function () {
var view = (
yo`<select size='10' id='asmitems' ref='itemsList' style=${ui.formatCss(style.instructionsList)}>
${this.codeView}
</select>`
)
if (!this.view) {
this.view = view
}
return view
}
ASMCode.prototype.init = function () {
this.codeManager.event.register('changed', this, this.changed)
}
ASMCode.prototype.indexChanged = function (index) {
document.getElementById('asmitems').value = index
}
ASMCode.prototype.changed = function (code, address, index) {
if (this.address !== address) {
this.code = code
this.address = address
this.renderAssemblyItems()
yo.update(this.view, this.render())
}
this.indexChanged(index)
}
ASMCode.prototype.renderAssemblyItems = function () {
if (this.code) {
this.codeView = this.code.map(function (item, i) {
return yo`<option key=${i} value=${i}>${item}</option>`
})
return this.codeView
}
}
module.exports = ASMCode

@ -41,6 +41,7 @@ DropdownPanel.prototype.render = function (overridestyle) {
var self = this
var view = yo`<div>
<div class='title' style=${ui.formatCss(styleDropdown.title)} onclick=${function () { self.toggle() }}>
<div style=${ui.formatCss(styleDropdown.caret)} class='fa fa-caret-right'></div>
<div style=${ui.formatCss(styleDropdown.inner, styleDropdown.titleInner)}>${this.name}</div>
</div>
<div class='dropdownpanel' style=${ui.formatCss(styleDropdown.content)} style='display:none'>
@ -65,24 +66,31 @@ DropdownPanel.prototype.toggleRaw = function () {
DropdownPanel.prototype.toggle = function () {
var el = this.view.querySelector('.dropdownpanel')
var caret = this.view.querySelector('.title').firstElementChild
if (el.style.display === '') {
el.style.display = 'none'
caret.className = 'fa fa-caret-right'
} else {
el.style.display = ''
caret.className = 'fa fa-caret-down'
}
}
DropdownPanel.prototype.hide = function () {
if (this.view) {
var caret = this.view.querySelector('.title').firstElementChild
var el = this.view.querySelector('.dropdownpanel')
el.style.display = 'none'
caret.className = 'fa fa-caret-right'
}
}
DropdownPanel.prototype.show = function () {
if (this.view) {
var caret = this.view.querySelector('.title').firstElementChild
var el = this.view.querySelector('.dropdownpanel')
el.style.display = ''
caret.className = 'fa fa-caret-down'
}
}

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var localDecoder = require('../solidity/localDecoder')
var solidityTypeFormatter = require('./SolidityTypeFormatter')
var yo = require('yo-yo')
class SolidityLocals {
@ -9,20 +10,32 @@ class SolidityLocals {
this.parent = _parent
this.internalTreeCall = internalTreeCall
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Solidity Locals', {json: true})
this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true,
formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData
})
this.init()
this.view
}
render () {
return yo`<div id='soliditylocals' >${this.basicPanel.render()}</div>`
this.view = yo`<div id='soliditylocals' >
<div id='warning'></div>
${this.basicPanel.render()}
</div>`
return this.view
}
init () {
this.parent.event.register('indexChanged', this, (index) => {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (index < 0) {
this.basicPanel.update({info: 'invalid step index'})
warningDiv.innerHTML = 'invalid step index'
return
}
if (this.parent.currentStepIndex !== index) return
this.traceManager.waterfall([
@ -33,8 +46,12 @@ class SolidityLocals {
if (!error) {
var stack = result[0].value
var memory = result[1].value
var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory)
this.basicPanel.update(locals)
try {
var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory)
this.basicPanel.update(locals)
} catch (e) {
warningDiv.innerHTML = e.message
}
}
})
})

@ -1,6 +1,7 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var stateDecoder = require('../solidity/stateDecoder')
var solidityTypeFormatter = require('./SolidityTypeFormatter')
var yo = require('yo-yo')
function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
@ -8,24 +9,36 @@ function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) {
this.traceManager = _traceManager
this.codeManager = _codeManager
this.solidityProxy = _solidityProxy
this.basicPanel = new DropdownPanel('Solidity State', {json: true})
this.basicPanel = new DropdownPanel('Solidity State', {
json: true,
formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData
})
this.init()
this.view
}
SolidityState.prototype.render = function () {
return yo`<div id='soliditystate' >${this.basicPanel.render()}</div>`
this.view = yo`<div id='soliditystate' >
<div id='warning'></div>
${this.basicPanel.render()}
</div>`
return this.view
}
SolidityState.prototype.init = function () {
var self = this
this.parent.event.register('indexChanged', this, function (index) {
var warningDiv = this.view.querySelector('#warning')
warningDiv.innerHTML = ''
if (index < 0) {
self.basicPanel.update({info: 'invalid step index'})
warningDiv.innerHTML = 'invalid step index'
return
}
if (self.parent.currentStepIndex !== index) return
if (!this.solidityProxy.loaded()) {
self.basicPanel.update({info: 'no source has been specified'})
warningDiv.innerHTML = 'no source has been specified'
return
}

@ -0,0 +1,66 @@
'use strict'
var yo = require('yo-yo')
var BN = require('ethereumjs-util').BN
module.exports = {
formatSelf: formatSelf,
extractData: extractData
}
function formatSelf (key, data) {
var style = fontColor(data)
var keyStyle = data.isProperty ? 'color:#847979' : ''
if (data.type === 'string') {
data.self = JSON.stringify(data.self)
}
return yo`<label style=${keyStyle}>${key}: <label style=${style}>${data.self}</label><label style='font-style:italic'> ${data.isProperty ? '' : data.type}</label></label>`
}
function extractData (item, parent, key) {
var ret = {}
if (item.isProperty) {
return item
}
if (item.type.lastIndexOf(']') === item.type.length - 1) {
ret.children = (item.value || []).map(function (item, index) {
return {key: index, value: item}
})
ret.children.unshift({
key: 'length',
value: {
self: (new BN(item.length.replace('0x', ''), 16)).toString(10),
type: 'uint',
isProperty: true
}
})
ret.isArray = true
ret.self = parent.isArray ? '' : item.type
} else if (item.type.indexOf('struct') === 0) {
ret.children = Object.keys((item.value || {})).map(function (key) {
return {key: key, value: item.value[key]}
})
ret.self = item.type
ret.isStruct = true
} else {
ret.children = []
ret.self = item.value
ret.type = item.type
}
return ret
}
function fontColor (data) {
var color = '#124B46'
if (data.isArray || data.isStruct) {
color = '#847979'
} else if (data.type.indexOf('uint') === 0 ||
data.type.indexOf('int') === 0 ||
data.type.indexOf('bool') === 0 ||
data.type.indexOf('enum') === 0) {
color = '#0F0CE9'
} else if (data.type === 'string') {
color = '#E91E0C'
}
return 'color:' + color
}

@ -11,14 +11,16 @@ class TreeView {
this.beforeJsonNodeRendered = opts.beforeJsonNodeRendered || noop
this.beforeJsonValueRendered = opts.beforeJsonValueRendered || noop
this.extractData = opts.extractData || this.extractDataDefault
this.formatData = opts.formatData || this.formatDataDefault
this.formatSelf = opts.formatSelf || this.formatSelfDefault
this.view = null
this.cssLabel = ui.formatCss(opts.css || {}, style.label)
this.cssList = ui.formatCss(opts.css || {}, style.list)
this.cssUl = ui.formatCss(opts.css || {}, style.cssUl)
this.cssLi = ui.formatCss(opts.css || {}, style.cssLi)
this.nodeIsExpanded = {}
}
render (json) {
var view = yo`<div>${this.renderProperties(json, true)}</div>`
var view = this.renderProperties(json, false)
if (!this.view) {
this.view = view
}
@ -27,52 +29,58 @@ class TreeView {
update (json) {
if (this.view) {
yo.update(this.view, this.render(json), {onBeforeElUpdated: (fromEl, toEl) => {
toEl.style.display = fromEl.style.display
toEl.className = fromEl.className
return true
}})
yo.update(this.view, this.render(json))
}
}
renderObject (item, key, expand) {
var data = this.extractData(item, key)
var children = Object.keys(data.children).map((innerkey) => {
return this.renderObject(data.children[innerkey], innerkey, expand)
renderObject (item, parent, key, expand, keyPath) {
var data = this.extractData(item, parent, key)
var children = (data.children || []).map((child, index) => {
return this.renderObject(child.value, data, child.key, expand, keyPath + ',' + child.key)
})
return this.formatData(key, data.self, children, expand)
return this.formatData(key, data, children, expand, keyPath)
}
renderProperties (json, expand) {
var children = Object.keys(json).map((innerkey) => {
return this.renderObject(json[innerkey], innerkey, expand)
return this.renderObject(json[innerkey], json, innerkey, expand, innerkey)
})
return yo`<ul style=${this.cssList}>${children}</ul>`
return yo`<ul style=${this.cssUl}>${children}</ul>`
}
formatDataDefault (key, self, children, expand) {
var label = yo`<span style=${this.cssLabel}><label style='width: 10px'></label><label>${key}: ${self}</label></span>`
formatData (key, data, children, expand, keyPath) {
var label = yo`<span style=${this.cssLabel}><label style=${ui.formatCss(style.caret)}></label><span style=${ui.formatCss(style.data)}>${this.formatSelf(key, data)}</span></span>`
var renderedChildren = ''
if (children.length) {
renderedChildren = yo`<ul style=${this.cssList}>${children}</ul>`
renderedChildren.style.display = expand ? 'block' : 'none'
label.firstElementChild.className = expand ? 'fa fa-caret-down' : 'fa fa-caret-right'
renderedChildren = yo`<ul style=${this.cssUl}>${children}</ul>`
renderedChildren.style.display = this.nodeIsExpanded[keyPath] !== undefined ? (this.nodeIsExpanded[keyPath] ? 'block' : 'none') : (expand ? 'block' : 'none')
label.firstElementChild.className = renderedChildren.style.display === 'none' ? 'fa fa-caret-right' : 'fa fa-caret-down'
var self = this
label.onclick = function () {
this.firstElementChild.className = this.firstElementChild.className === 'fa fa-caret-right' ? 'fa fa-caret-down' : 'fa fa-caret-right'
var list = this.parentElement.querySelector('ul')
list.style.display = list.style.display === 'none' ? 'block' : 'none'
self.nodeIsExpanded[keyPath] = list.style.display === 'block'
}
}
return yo`<li style=${this.cssList}>${label}${renderedChildren}</li>`
return yo`<li style=${this.cssLi}>${label}${renderedChildren}</li>`
}
extractDataDefault (item, key) {
formatSelfDefault (key, data) {
return yo`<label>${key}: ${data.self}</label>`
}
extractDataDefault (item, parent, key) {
var ret = {}
if (item instanceof Array) {
ret.children = item
ret.children = item.map((item, index) => {
return {key: index, value: item}
})
ret.self = 'Array'
} else if (item instanceof Object) {
ret.children = item
ret.children = Object.keys(item).map((key) => {
return {key: key, value: item[key]}
})
ret.self = 'Object'
} else {
ret.self = item

@ -27,7 +27,9 @@ module.exports = {
'width': '52%',
'overflow-y': 'scroll',
'max-height': '250px',
'margin': '0'
'margin': '0',
'margin-left': '10px',
'padding': '2px'
},
transactionInfo: {
'margin-top': '5px'

@ -13,15 +13,18 @@ module.exports = {
},
content: {
'color': '#111111',
'width': '100%'
'width': '100%',
'min-height': '20px'
},
inner: {
'padding': '2px',
'margin-left': '10px',
'word-break': 'break-all'
},
copyBtn: {
'float': 'right',
'margin-top': '3px'
},
caret: {
'margin-left': '5px'
}
}

@ -1,6 +1,14 @@
'use strict'
module.exports = {
list: {
cssUl: {
'list-style-type': 'none',
'-webkit-margin-before': '0px',
'-webkit-margin-after': '0px',
'-webkit-margin-start': '0px',
'-webkit-margin-end': '0px',
'-webkit-padding-start': '0px'
},
cssLi: {
'list-style-type': 'none',
'-webkit-margin-before': '0px',
'-webkit-margin-after': '0px',
@ -12,5 +20,12 @@ module.exports = {
label: {
'vertical-align': 'top',
'font-family': 'arial,sans-serif'
},
caret: {
'position': 'absolute',
'margin-top': '3px'
},
data: {
'margin-left': '10px'
}
}

@ -128,7 +128,7 @@ browser.fireEvent = function (el, key, times, callback) {
}
function assertPanel (id, browser, value) {
var selector = '.dropdownpanel div.dropdowncontent div ul'
var selector = '.dropdownpanel div.dropdowncontent ul'
browser.execute(function (id, selector) {
var el = document.getElementById(id.replace('#', '').replace('.', ''))
var node = el.querySelector(selector)
@ -153,7 +153,7 @@ function assertPanel (id, browser, value) {
}
function assertPanelValue (id, browser, index, value) {
var selector = id + ' .dropdownpanel .dropdowncontent div ul'
var selector = id + ' .dropdownpanel .dropdowncontent ul'
browser.execute(function (id, index) {
var node = document.querySelector(id)
return node.children[index].innerText

@ -13,31 +13,31 @@ tape('solidity', function (t) {
var states = index.solidity.astHelper.extractStatesDefinitions(output.sources)
var stateDef = state.stateDefinitions
var decodeInfo = index.solidity.decodeInfo.parseType(stateDef[0].attributes.type, states, 'contractUint')
checkDecodeInfo(st, decodeInfo, 1, 1, 'uint')
checkDecodeInfo(st, decodeInfo, 1, 1, 'uint8')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[2].attributes.type, states, 'contractUint')
checkDecodeInfo(st, decodeInfo, 1, 32, 'uint')
checkDecodeInfo(st, decodeInfo, 1, 32, 'uint256')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[3].attributes.type, states, 'contractUint')
checkDecodeInfo(st, decodeInfo, 1, 32, 'uint')
checkDecodeInfo(st, decodeInfo, 1, 32, 'uint256')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[4].attributes.type, states, 'contractUint')
checkDecodeInfo(st, decodeInfo, 1, 16, 'bytesX')
checkDecodeInfo(st, decodeInfo, 1, 16, 'bytes16')
state = index.solidity.astHelper.extractStateDefinitions('contractStructAndArray', output.sources)
stateDef = state.stateDefinitions
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[1].attributes.type, states, 'contractStructAndArray')
checkDecodeInfo(st, decodeInfo, 2, 32, 'struct')
checkDecodeInfo(st, decodeInfo, 2, 32, 'struct contractStructAndArray.structDef')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[2].attributes.type, states, 'contractStructAndArray')
checkDecodeInfo(st, decodeInfo, 6, 32, 'array')
checkDecodeInfo(st, decodeInfo, 6, 32, 'struct contractStructAndArray.structDef[3]')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[3].attributes.type, states, 'contractStructAndArray')
checkDecodeInfo(st, decodeInfo, 2, 32, 'array')
checkDecodeInfo(st, decodeInfo, 2, 32, 'bytes12[4]')
state = index.solidity.astHelper.extractStateDefinitions('contractArray', output.sources)
stateDef = state.stateDefinitions
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[0].attributes.type, states, 'contractArray')
checkDecodeInfo(st, decodeInfo, 1, 32, 'array')
checkDecodeInfo(st, decodeInfo, 1, 32, 'uint32[5]')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[1].attributes.type, states, 'contractArray')
checkDecodeInfo(st, decodeInfo, 1, 32, 'array')
checkDecodeInfo(st, decodeInfo, 1, 32, 'int8[]')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[2].attributes.type, states, 'contractArray')
checkDecodeInfo(st, decodeInfo, 4, 32, 'array')
checkDecodeInfo(st, decodeInfo, 4, 32, 'int16[][3][][4]')
state = index.solidity.astHelper.extractStateDefinitions('contractEnum', output.sources)
stateDef = state.stateDefinitions
@ -47,17 +47,17 @@ tape('solidity', function (t) {
state = index.solidity.astHelper.extractStateDefinitions('contractSmallVariable', output.sources)
stateDef = state.stateDefinitions
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[0].attributes.type, states, 'contractSmallVariable')
checkDecodeInfo(st, decodeInfo, 1, 1, 'int')
checkDecodeInfo(st, decodeInfo, 1, 1, 'int8')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[1].attributes.type, states, 'contractSmallVariable')
checkDecodeInfo(st, decodeInfo, 1, 1, 'uint')
checkDecodeInfo(st, decodeInfo, 1, 1, 'uint8')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[2].attributes.type, states, 'contractSmallVariable')
checkDecodeInfo(st, decodeInfo, 1, 2, 'uint')
checkDecodeInfo(st, decodeInfo, 1, 2, 'uint16')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[3].attributes.type, states, 'contractSmallVariable')
checkDecodeInfo(st, decodeInfo, 1, 4, 'int')
checkDecodeInfo(st, decodeInfo, 1, 4, 'int32')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[4].attributes.type, states, 'contractSmallVariable')
checkDecodeInfo(st, decodeInfo, 1, 32, 'uint')
checkDecodeInfo(st, decodeInfo, 1, 32, 'uint256')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[5].attributes.type, states, 'contractSmallVariable')
checkDecodeInfo(st, decodeInfo, 1, 2, 'int')
checkDecodeInfo(st, decodeInfo, 1, 2, 'int16')
output = compiler.compile(simplecontracts, 0)
@ -65,19 +65,19 @@ tape('solidity', function (t) {
states = index.solidity.astHelper.extractStatesDefinitions(output.sources)
stateDef = state.stateDefinitions
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[2].attributes.type, states, 'simpleContract')
checkDecodeInfo(st, decodeInfo, 2, 32, 'struct')
checkDecodeInfo(st, decodeInfo, 2, 32, 'struct simpleContract.structDef')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[3].attributes.type, states, 'simpleContract')
checkDecodeInfo(st, decodeInfo, 6, 32, 'array')
checkDecodeInfo(st, decodeInfo, 6, 32, 'struct simpleContract.structDef[3]')
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[4].attributes.type, states, 'simpleContract')
checkDecodeInfo(st, decodeInfo, 1, 1, 'enum')
state = index.solidity.astHelper.extractStateDefinitions('test2', output.sources)
stateDef = state.stateDefinitions
decodeInfo = index.solidity.decodeInfo.parseType(stateDef[0].attributes.type, states, 'test1')
checkDecodeInfo(st, decodeInfo, 0, 32, 'struct')
checkDecodeInfo(st, decodeInfo, 0, 32, 'struct test1.str')
state = index.solidity.stateDecoder.extractStateVariables('test2', output.sources)
checkDecodeInfo(st, decodeInfo, 0, 32, 'struct')
checkDecodeInfo(st, decodeInfo, 0, 32, 'struct test1.str')
st.end()
})

@ -37,52 +37,52 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
st.equals(scopeStarts[135], '2')
st.equals(scopeStarts[154], '3')
st.equals(scopeStarts[169], '3.1')
st.equals(scopes[''].locals['ui8'].type.typeName, 'uint')
st.equals(scopes[''].locals['ui16'].type.typeName, 'uint')
st.equals(scopes[''].locals['ui32'].type.typeName, 'uint')
st.equals(scopes[''].locals['ui64'].type.typeName, 'uint')
st.equals(scopes[''].locals['ui128'].type.typeName, 'uint')
st.equals(scopes[''].locals['ui256'].type.typeName, 'uint')
st.equals(scopes[''].locals['ui'].type.typeName, 'uint')
st.equals(scopes[''].locals['i8'].type.typeName, 'int')
st.equals(scopes[''].locals['i16'].type.typeName, 'int')
st.equals(scopes[''].locals['i32'].type.typeName, 'int')
st.equals(scopes[''].locals['i64'].type.typeName, 'int')
st.equals(scopes[''].locals['i128'].type.typeName, 'int')
st.equals(scopes[''].locals['i256'].type.typeName, 'int')
st.equals(scopes[''].locals['i'].type.typeName, 'int')
st.equals(scopes[''].locals['ishrink'].type.typeName, 'int')
st.equals(scopes['1'].locals['ui8'].type.typeName, 'uint')
st.equals(scopes['1.1'].locals['ui81'].type.typeName, 'uint')
st.equals(scopes['2'].locals['ui81'].type.typeName, 'uint')
st.equals(scopes['3'].locals['ui8'].type.typeName, 'uint')
st.equals(scopes['3.1'].locals['ui81'].type.typeName, 'uint')
st.equals(scopes[''].locals['ui8'].type.typeName, 'uint8')
st.equals(scopes[''].locals['ui16'].type.typeName, 'uint16')
st.equals(scopes[''].locals['ui32'].type.typeName, 'uint32')
st.equals(scopes[''].locals['ui64'].type.typeName, 'uint64')
st.equals(scopes[''].locals['ui128'].type.typeName, 'uint128')
st.equals(scopes[''].locals['ui256'].type.typeName, 'uint256')
st.equals(scopes[''].locals['ui'].type.typeName, 'uint256')
st.equals(scopes[''].locals['i8'].type.typeName, 'int8')
st.equals(scopes[''].locals['i16'].type.typeName, 'int16')
st.equals(scopes[''].locals['i32'].type.typeName, 'int32')
st.equals(scopes[''].locals['i64'].type.typeName, 'int64')
st.equals(scopes[''].locals['i128'].type.typeName, 'int128')
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')
} catch (e) {
st.fail(e.message)
}
helper.decodeLocals(st, 125, traceManager, callTree, function (locals) {
st.equals(Object.keys(locals).length, 16)
st.equals(locals['ui8'], '130')
st.equals(locals['ui16'], '456')
st.equals(locals['ui32'], '4356')
st.equals(locals['ui64'], '3543543543')
st.equals(locals['ui128'], '234567')
st.equals(locals['ui256'], '115792089237316195423570985008687907853269984665640564039457584007880697216513')
st.equals(locals['ui'], '123545666')
st.equals(locals['i8'], '-45')
st.equals(locals['i16'], '-1234')
st.equals(locals['i32'], '3455')
st.equals(locals['i64'], '-35566')
st.equals(locals['i128'], '-444444')
st.equals(locals['i256'], '3434343')
st.equals(locals['i'], '-32432423423')
st.equals(locals['ishrink'], '2')
st.equals(locals['ui8'].value, '130')
st.equals(locals['ui16'].value, '456')
st.equals(locals['ui32'].value, '4356')
st.equals(locals['ui64'].value, '3543543543')
st.equals(locals['ui128'].value, '234567')
st.equals(locals['ui256'].value, '115792089237316195423570985008687907853269984665640564039457584007880697216513')
st.equals(locals['ui'].value, '123545666')
st.equals(locals['i8'].value, '-45')
st.equals(locals['i16'].value, '-1234')
st.equals(locals['i32'].value, '3455')
st.equals(locals['i64'].value, '-35566')
st.equals(locals['i128'].value, '-444444')
st.equals(locals['i256'].value, '3434343')
st.equals(locals['i'].value, '-32432423423')
st.equals(locals['ishrink'].value, '2')
})
helper.decodeLocals(st, 177, traceManager, callTree, function (locals) {
try {
st.equals(locals['ui8'], '123')
st.equals(locals['ui8'].value, '123')
st.equals(Object.keys(locals).length, 1)
} catch (e) {
st.fail(e.message)

@ -32,22 +32,22 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
helper.decodeLocals(st, 70, traceManager, callTree, function (locals) {
try {
st.equals(locals['boolFalse'], false)
st.equals(locals['boolTrue'], true)
st.equals(locals['testEnum'], 'three')
st.equals(locals['sender'], '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB')
st.equals(locals['_bytes1'], '0x99')
st.equals(locals['__bytes1'], '0x99')
st.equals(locals['__bytes2'], '0x99AB')
st.equals(locals['__bytes4'], '0x99FA0000')
st.equals(locals['__bytes6'], '0x990000000000')
st.equals(locals['__bytes7'], '0x99356700000000')
st.equals(locals['__bytes8'], '0x99ABD41700000000')
st.equals(locals['__bytes9'], '0x99156744AF00000000')
st.equals(locals['__bytes13'], '0x99123423425300000000000000')
st.equals(locals['__bytes16'], '0x99AFAD23432400000000000000000000')
st.equals(locals['__bytes24'], '0x99AFAD234324000000000000000000000000000000000000')
st.equals(locals['__bytes32'], '0x9999ABD41799ABD4170000000000000000000000000000000000000000000000')
st.equals(locals['boolFalse'].value, false)
st.equals(locals['boolTrue'].value, true)
st.equals(locals['testEnum'].value, 'three')
st.equals(locals['sender'].value, '0x4B0897B0513FDC7C541B6D9D7E929C4E5364D2DB')
st.equals(locals['_bytes1'].value, '0x99')
st.equals(locals['__bytes1'].value, '0x99')
st.equals(locals['__bytes2'].value, '0x99AB')
st.equals(locals['__bytes4'].value, '0x99FA0000')
st.equals(locals['__bytes6'].value, '0x990000000000')
st.equals(locals['__bytes7'].value, '0x99356700000000')
st.equals(locals['__bytes8'].value, '0x99ABD41700000000')
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, 16)
} catch (e) {
st.fail(e.message)
@ -56,22 +56,22 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
helper.decodeLocals(st, 7, traceManager, callTree, function (locals) {
try {
st.equals(locals['boolFalse'], false)
st.equals(locals['boolTrue'], false)
st.equals(locals['testEnum'], 'one')
st.equals(locals['sender'], '0x0000000000000000000000000000000000000000')
st.equals(locals['_bytes1'], '0x')
st.equals(locals['__bytes1'], '0x')
st.equals(locals['__bytes2'], '0x')
st.equals(locals['__bytes4'], '0x')
st.equals(locals['__bytes6'], '0x')
st.equals(locals['__bytes7'], '0x')
st.equals(locals['__bytes8'], '0x')
st.equals(locals['__bytes9'], '0x')
st.equals(locals['__bytes13'], '0x')
st.equals(locals['__bytes16'], '0x')
st.equals(locals['__bytes24'], '0x')
st.equals(locals['__bytes32'], '0x')
st.equals(locals['boolFalse'].value, false)
st.equals(locals['boolTrue'].value, false)
st.equals(locals['testEnum'].value, 'one')
st.equals(locals['sender'].value, '0x0000000000000000000000000000000000000000')
st.equals(locals['_bytes1'].value, '0x')
st.equals(locals['__bytes1'].value, '0x')
st.equals(locals['__bytes2'].value, '0x')
st.equals(locals['__bytes4'].value, '0x')
st.equals(locals['__bytes6'].value, '0x')
st.equals(locals['__bytes7'].value, '0x')
st.equals(locals['__bytes8'].value, '0x')
st.equals(locals['__bytes9'].value, '0x')
st.equals(locals['__bytes13'].value, '0x')
st.equals(locals['__bytes16'].value, '0x')
st.equals(locals['__bytes24'].value, '0x')
st.equals(locals['__bytes32'].value, '0x')
st.equals(Object.keys(locals).length, 16)
} catch (e) {
st.fail(e.message)

@ -34,63 +34,63 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
try {
st.equals(locals['bytesSimple'].length, '0x14')
st.equals(locals['bytesSimple'].value, '0x746573745f7375706572')
st.equals(locals['e']['a'].value, 'test')
st.equals(locals['e']['a'].length, '0x8')
st.equals(locals['e']['a'].raw, '0x74657374')
st.equals(locals['e']['b'], '5')
st.equals(locals['e']['c'].length, '0x220')
st.equals(locals['e']['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374')
st.equals(locals['e']['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test')
st.equals(locals['e']['d'], '3')
st.equals(locals['e'].value['a'].value, 'test')
st.equals(locals['e'].value['a'].length, '0x8')
st.equals(locals['e'].value['a'].raw, '0x74657374')
st.equals(locals['e'].value['b'].value, '5')
st.equals(locals['e'].value['c'].length, '0x220')
st.equals(locals['e'].value['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374')
st.equals(locals['e'].value['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test')
st.equals(locals['e'].value['d'].value, '3')
st.equals(locals['f'].length, '0x1b8')
st.equals(locals['f'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f')
st.equals(locals['f'].value, 'test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_test_long_')
st.equals(locals['e']['e'], true)
st.equals(locals['e'].value['e'].value, true)
st.equals(locals['simpleArray'][0], '45')
st.equals(locals['simpleArray'][1], '324324')
st.equals(locals['simpleArray'][2], '-333')
st.equals(locals['simpleArray'][3], '5656')
st.equals(locals['simpleArray'][4], '-1111')
st.equals(locals['simpleArray'].value[0].value, '45')
st.equals(locals['simpleArray'].value[1].value, '324324')
st.equals(locals['simpleArray'].value[2].value, '-333')
st.equals(locals['simpleArray'].value[3].value, '5656')
st.equals(locals['simpleArray'].value[4].value, '-1111')
st.equals(locals['stringArray'][0].value, 'long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_')
st.equals(locals['stringArray'][1].value, 'two')
st.equals(locals['stringArray'][2].value, 'three')
st.equals(locals['stringArray'].value[0].value, 'long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_long_one_')
st.equals(locals['stringArray'].value[1].value, 'two')
st.equals(locals['stringArray'].value[2].value, 'three')
st.equals(locals['dynArray'][0][0], '3423423532')
st.equals(locals['dynArray'][1][0], '-342343323532')
st.equals(locals['dynArray'][1][1], '23432')
st.equals(locals['dynArray'][2][0], '-432432')
st.equals(locals['dynArray'][2][1], '3423423532')
st.equals(locals['dynArray'][2][2], '-432432')
st.equals(locals['dynArray'].value[0].value[0].value, '3423423532')
st.equals(locals['dynArray'].value[1].value[0].value, '-342343323532')
st.equals(locals['dynArray'].value[1].value[1].value, '23432')
st.equals(locals['dynArray'].value[2].value[0].value, '-432432')
st.equals(locals['dynArray'].value[2].value[1].value, '3423423532')
st.equals(locals['dynArray'].value[2].value[2].value, '-432432')
st.equals(locals['structArray'][0]['a'].value, 'test')
st.equals(locals['structArray'][0]['a'].length, '0x8')
st.equals(locals['structArray'][0]['a'].raw, '0x74657374')
st.equals(locals['structArray'][0]['b'], '5')
st.equals(locals['structArray'][0]['c'].length, '0x220')
st.equals(locals['structArray'][0]['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374')
st.equals(locals['structArray'][0]['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test')
st.equals(locals['structArray'][0]['d'], '3')
st.equals(locals['structArray'][0]['e'], true)
st.equals(locals['structArray'].value[0].value['a'].value, 'test')
st.equals(locals['structArray'].value[0].value['a'].length, '0x8')
st.equals(locals['structArray'].value[0].value['a'].raw, '0x74657374')
st.equals(locals['structArray'].value[0].value['b'].value, '5')
st.equals(locals['structArray'].value[0].value['c'].length, '0x220')
st.equals(locals['structArray'].value[0].value['c'].raw, '0x746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374746573745f6c6f6e675f746573745f6c6f6e675f746573745f6c6f6e675f74657374')
st.equals(locals['structArray'].value[0].value['c'].value, 'test_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_testtest_long_test_long_test_long_test')
st.equals(locals['structArray'].value[0].value['d'].value, '3')
st.equals(locals['structArray'].value[0].value['e'].value, true)
st.equals(locals['structArray'][1]['a'].value, 'item1 a')
st.equals(locals['structArray'][1]['b'], '20')
st.equals(locals['structArray'][1]['c'].value, 'item1 c')
st.equals(locals['structArray'][1]['d'], '-45')
st.equals(locals['structArray'][1]['e'], false)
st.equals(locals['structArray'].value[1].value['a'].value, 'item1 a')
st.equals(locals['structArray'].value[1].value['b'].value, '20')
st.equals(locals['structArray'].value[1].value['c'].value, 'item1 c')
st.equals(locals['structArray'].value[1].value['d'].value, '-45')
st.equals(locals['structArray'].value[1].value['e'].value, false)
st.equals(locals['structArray'][2]['a'].value, 'item2 a')
st.equals(locals['structArray'][2]['b'], '200')
st.equals(locals['structArray'][2]['c'].value, 'item2 c')
st.equals(locals['structArray'][2]['d'], '-450')
st.equals(locals['structArray'][2]['e'], true)
st.equals(locals['structArray'].value[2].value['a'].value, 'item2 a')
st.equals(locals['structArray'].value[2].value['b'].value, '200')
st.equals(locals['structArray'].value[2].value['c'].value, 'item2 c')
st.equals(locals['structArray'].value[2].value['d'].value, '-450')
st.equals(locals['structArray'].value[2].value['e'].value, true)
st.equals(locals['arrayStruct'].a[0].value, 'string')
st.equals(locals['arrayStruct'].b[0], '34')
st.equals(locals['arrayStruct'].b[1], '-23')
st.equals(locals['arrayStruct'].b[2], '-3')
st.equals(locals['arrayStruct'].c, 'three')
st.equals(locals['arrayStruct'].value.a.value[0].value, 'string')
st.equals(locals['arrayStruct'].value.b.value[0].value, '34')
st.equals(locals['arrayStruct'].value.b.value[1].value, '-23')
st.equals(locals['arrayStruct'].value.b.value[2].value, '-3')
st.equals(locals['arrayStruct'].value.c.value, 'three')
st.equals(Object.keys(locals).length, 8)
} catch (e) {

@ -17,39 +17,39 @@ function testIntStorage (st) {
var output = compiler.compile(intStorage.contract, 0)
for (var storage of [intStorage.fullStorage, shrinkStorage(intStorage.fullStorage)]) {
var decoded = stateDecoder.solidityState(storage, output.sources, 'intStorage')
st.equal(decoded['ui8'], '130')
st.equal(decoded['ui16'], '456')
st.equal(decoded['ui32'], '4356')
st.equal(decoded['ui64'], '3543543543')
st.equal(decoded['ui128'], '234567')
st.equal(decoded['ui256'], '115792089237316195423570985008687907853269984665640564039457584007880697216513')
st.equal(decoded['ui'], '123545666')
st.equal(decoded['i8'], '-45')
st.equal(decoded['i16'], '-1234')
st.equal(decoded['i32'], '3455')
st.equal(decoded['i64'], '-35566')
st.equal(decoded['i128'], '-444444')
st.equal(decoded['i256'], '3434343')
st.equal(decoded['i'], '-32432423423')
st.equal(decoded['ishrink'], '2')
st.equal(decoded['ui8'].value, '130')
st.equal(decoded['ui16'].value, '456')
st.equal(decoded['ui32'].value, '4356')
st.equal(decoded['ui64'].value, '3543543543')
st.equal(decoded['ui128'].value, '234567')
st.equal(decoded['ui256'].value, '115792089237316195423570985008687907853269984665640564039457584007880697216513')
st.equal(decoded['ui'].value, '123545666')
st.equal(decoded['i8'].value, '-45')
st.equal(decoded['i16'].value, '-1234')
st.equal(decoded['i32'].value, '3455')
st.equal(decoded['i64'].value, '-35566')
st.equal(decoded['i128'].value, '-444444')
st.equal(decoded['i256'].value, '3434343')
st.equal(decoded['i'].value, '-32432423423')
st.equal(decoded['ishrink'].value, '2')
}
decoded = stateDecoder.solidityState({}, output.sources, 'intStorage')
st.equal(decoded['ui8'], '0')
st.equal(decoded['ui16'], '0')
st.equal(decoded['ui32'], '0')
st.equal(decoded['ui64'], '0')
st.equal(decoded['ui128'], '0')
st.equal(decoded['ui256'], '0')
st.equal(decoded['ui'], '0')
st.equal(decoded['i8'], '0')
st.equal(decoded['i16'], '0')
st.equal(decoded['i32'], '0')
st.equal(decoded['i64'], '0')
st.equal(decoded['i128'], '0')
st.equal(decoded['i256'], '0')
st.equal(decoded['i'], '0')
st.equal(decoded['ishrink'], '0')
st.equal(decoded['ui8'].value, '0')
st.equal(decoded['ui16'].value, '0')
st.equal(decoded['ui32'].value, '0')
st.equal(decoded['ui64'].value, '0')
st.equal(decoded['ui128'].value, '0')
st.equal(decoded['ui256'].value, '0')
st.equal(decoded['ui'].value, '0')
st.equal(decoded['i8'].value, '0')
st.equal(decoded['i16'].value, '0')
st.equal(decoded['i32'].value, '0')
st.equal(decoded['i64'].value, '0')
st.equal(decoded['i128'].value, '0')
st.equal(decoded['i256'].value, '0')
st.equal(decoded['i'].value, '0')
st.equal(decoded['ishrink'].value, '0')
}
function testByteStorage (st) {
@ -57,90 +57,90 @@ function testByteStorage (st) {
var output = compiler.compile(byteStorage.contract, 0)
for (var storage of [byteStorage.storage, shrinkStorage(byteStorage.storage)]) {
var decoded = stateDecoder.solidityState(storage, output.sources, 'byteStorage')
st.equal(decoded['b1'], false)
st.equal(decoded['a1'], '0xFE350F199F244AC9A79038D254400B632A633225')
st.equal(decoded['b2'], true)
st.equal(decoded['b1'].value, false)
st.equal(decoded['a1'].value, '0xFE350F199F244AC9A79038D254400B632A633225')
st.equal(decoded['b2'].value, true)
st.equal(decoded['dynb1'].value, '0x64796e616d69636279746573')
st.equal(decoded['dynb1'].length, '0xc')
st.equal(decoded['stab'], '0x01')
st.equal(decoded['stab1'], '0x12')
st.equal(decoded['stab2'], '0x1579')
st.equal(decoded['stab3'], '0x359356')
st.equal(decoded['stab4'], '0x23750000')
st.equal(decoded['stab5'], '0x0235764500')
st.equal(decoded['stab6'], '0x324435000000')
st.equal(decoded['stab7'], '0x00432400000000')
st.equal(decoded['stab8'], '0x3245546457650000')
st.equal(decoded['stab9'], '0x034345430000000000')
st.equal(decoded['stab10'], '0x04543543654657000000')
st.equal(decoded['stab11'], '0x5435465400000000000000')
st.equal(decoded['stab12'], '0x030000000000000000000000')
st.equal(decoded['stab13'], '0x03243242345435000000000000')
st.equal(decoded['stab14'], '0x3245435435435300000000000000')
st.equal(decoded['stab15'], '0x032454434435000000000000000000')
st.equal(decoded['stab16'], '0x32454354440000000000000000000000')
st.equal(decoded['stab17'], '0x0324543432432432450000000000000000')
st.equal(decoded['stab18'], '0x032453432543543500000000000000000000')
st.equal(decoded['stab19'], '0x03245434354354350000000000000000000000')
st.equal(decoded['stab20'], '0x032454543543AB35000000000000000000000000')
st.equal(decoded['stab21'], '0x324544324234350000000000000000000000000000')
st.equal(decoded['stab22'], '0x324543AEF50000000000000000000000000000000000')
st.equal(decoded['stab23'], '0x3245435FFF000000000000000000000000000000000000')
st.equal(decoded['stab24'], '0x3245435F0000000000000000000000000000000000000000')
st.equal(decoded['stab25'], '0x3245435F000000000000000000000000000000000000000000')
st.equal(decoded['stab26'], '0x3245435F00000000000000000000000000000000000000000000')
st.equal(decoded['stab27'], '0x03245FFFFFFF000000000000000000000000000000000000000000')
st.equal(decoded['stab28'], '0x03241235000000000000000000000000000000000000000000000000')
st.equal(decoded['stab29'], '0x0325213213000000000000000000000000000000000000000000000000')
st.equal(decoded['stab30'], '0x032454352324230000000000000000000000000000000000000000000000')
st.equal(decoded['stab31'], '0x32454351230000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab32'], '0x324324423432543543AB00000000000000000000000000000000000000000000')
st.equal(decoded['enumDec'], 'e240')
st.equal(decoded['stab'].value, '0x01')
st.equal(decoded['stab1'].value, '0x12')
st.equal(decoded['stab2'].value, '0x1579')
st.equal(decoded['stab3'].value, '0x359356')
st.equal(decoded['stab4'].value, '0x23750000')
st.equal(decoded['stab5'].value, '0x0235764500')
st.equal(decoded['stab6'].value, '0x324435000000')
st.equal(decoded['stab7'].value, '0x00432400000000')
st.equal(decoded['stab8'].value, '0x3245546457650000')
st.equal(decoded['stab9'].value, '0x034345430000000000')
st.equal(decoded['stab10'].value, '0x04543543654657000000')
st.equal(decoded['stab11'].value, '0x5435465400000000000000')
st.equal(decoded['stab12'].value, '0x030000000000000000000000')
st.equal(decoded['stab13'].value, '0x03243242345435000000000000')
st.equal(decoded['stab14'].value, '0x3245435435435300000000000000')
st.equal(decoded['stab15'].value, '0x032454434435000000000000000000')
st.equal(decoded['stab16'].value, '0x32454354440000000000000000000000')
st.equal(decoded['stab17'].value, '0x0324543432432432450000000000000000')
st.equal(decoded['stab18'].value, '0x032453432543543500000000000000000000')
st.equal(decoded['stab19'].value, '0x03245434354354350000000000000000000000')
st.equal(decoded['stab20'].value, '0x032454543543AB35000000000000000000000000')
st.equal(decoded['stab21'].value, '0x324544324234350000000000000000000000000000')
st.equal(decoded['stab22'].value, '0x324543AEF50000000000000000000000000000000000')
st.equal(decoded['stab23'].value, '0x3245435FFF000000000000000000000000000000000000')
st.equal(decoded['stab24'].value, '0x3245435F0000000000000000000000000000000000000000')
st.equal(decoded['stab25'].value, '0x3245435F000000000000000000000000000000000000000000')
st.equal(decoded['stab26'].value, '0x3245435F00000000000000000000000000000000000000000000')
st.equal(decoded['stab27'].value, '0x03245FFFFFFF000000000000000000000000000000000000000000')
st.equal(decoded['stab28'].value, '0x03241235000000000000000000000000000000000000000000000000')
st.equal(decoded['stab29'].value, '0x0325213213000000000000000000000000000000000000000000000000')
st.equal(decoded['stab30'].value, '0x032454352324230000000000000000000000000000000000000000000000')
st.equal(decoded['stab31'].value, '0x32454351230000000000000000000000000000000000000000000000000000')
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')
}
decoded = stateDecoder.solidityState({}, output.sources, 'byteStorage')
st.equal(decoded['b1'], false)
st.equal(decoded['a1'], '0x0000000000000000000000000000000000000000')
st.equal(decoded['b2'], false)
st.equal(decoded['b1'].value, false)
st.equal(decoded['a1'].value, '0x0000000000000000000000000000000000000000')
st.equal(decoded['b2'].value, false)
st.equal(decoded['dynb1'].value, '0x')
st.equal(decoded['dynb1'].length, '0x0')
st.equal(decoded['stab'], '0x00')
st.equal(decoded['stab1'], '0x00')
st.equal(decoded['stab2'], '0x0000')
st.equal(decoded['stab3'], '0x000000')
st.equal(decoded['stab4'], '0x00000000')
st.equal(decoded['stab5'], '0x0000000000')
st.equal(decoded['stab6'], '0x000000000000')
st.equal(decoded['stab7'], '0x00000000000000')
st.equal(decoded['stab8'], '0x0000000000000000')
st.equal(decoded['stab9'], '0x000000000000000000')
st.equal(decoded['stab10'], '0x00000000000000000000')
st.equal(decoded['stab11'], '0x0000000000000000000000')
st.equal(decoded['stab12'], '0x000000000000000000000000')
st.equal(decoded['stab13'], '0x00000000000000000000000000')
st.equal(decoded['stab14'], '0x0000000000000000000000000000')
st.equal(decoded['stab15'], '0x000000000000000000000000000000')
st.equal(decoded['stab16'], '0x00000000000000000000000000000000')
st.equal(decoded['stab17'], '0x0000000000000000000000000000000000')
st.equal(decoded['stab18'], '0x000000000000000000000000000000000000')
st.equal(decoded['stab19'], '0x00000000000000000000000000000000000000')
st.equal(decoded['stab20'], '0x0000000000000000000000000000000000000000')
st.equal(decoded['stab21'], '0x000000000000000000000000000000000000000000')
st.equal(decoded['stab22'], '0x00000000000000000000000000000000000000000000')
st.equal(decoded['stab23'], '0x0000000000000000000000000000000000000000000000')
st.equal(decoded['stab24'], '0x000000000000000000000000000000000000000000000000')
st.equal(decoded['stab25'], '0x00000000000000000000000000000000000000000000000000')
st.equal(decoded['stab26'], '0x0000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab27'], '0x000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab28'], '0x00000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab29'], '0x0000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab30'], '0x000000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab31'], '0x00000000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab32'], '0x0000000000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['enumDec'], 'e0')
st.equal(decoded['stab'].value, '0x00')
st.equal(decoded['stab1'].value, '0x00')
st.equal(decoded['stab2'].value, '0x0000')
st.equal(decoded['stab3'].value, '0x000000')
st.equal(decoded['stab4'].value, '0x00000000')
st.equal(decoded['stab5'].value, '0x0000000000')
st.equal(decoded['stab6'].value, '0x000000000000')
st.equal(decoded['stab7'].value, '0x00000000000000')
st.equal(decoded['stab8'].value, '0x0000000000000000')
st.equal(decoded['stab9'].value, '0x000000000000000000')
st.equal(decoded['stab10'].value, '0x00000000000000000000')
st.equal(decoded['stab11'].value, '0x0000000000000000000000')
st.equal(decoded['stab12'].value, '0x000000000000000000000000')
st.equal(decoded['stab13'].value, '0x00000000000000000000000000')
st.equal(decoded['stab14'].value, '0x0000000000000000000000000000')
st.equal(decoded['stab15'].value, '0x000000000000000000000000000000')
st.equal(decoded['stab16'].value, '0x00000000000000000000000000000000')
st.equal(decoded['stab17'].value, '0x0000000000000000000000000000000000')
st.equal(decoded['stab18'].value, '0x000000000000000000000000000000000000')
st.equal(decoded['stab19'].value, '0x00000000000000000000000000000000000000')
st.equal(decoded['stab20'].value, '0x0000000000000000000000000000000000000000')
st.equal(decoded['stab21'].value, '0x000000000000000000000000000000000000000000')
st.equal(decoded['stab22'].value, '0x00000000000000000000000000000000000000000000')
st.equal(decoded['stab23'].value, '0x0000000000000000000000000000000000000000000000')
st.equal(decoded['stab24'].value, '0x000000000000000000000000000000000000000000000000')
st.equal(decoded['stab25'].value, '0x00000000000000000000000000000000000000000000000000')
st.equal(decoded['stab26'].value, '0x0000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab27'].value, '0x000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab28'].value, '0x00000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab29'].value, '0x0000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab30'].value, '0x000000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab31'].value, '0x00000000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['stab32'].value, '0x0000000000000000000000000000000000000000000000000000000000000000')
st.equal(decoded['enumDec'].value, 'e0')
st.equal(decoded['str1'].length, '0x0')
st.equal(decoded['str2'].length, '0x0')
st.equal(decoded['str1'].value, '')
@ -162,95 +162,95 @@ function testStructArrayStorage (st) {
var structArrayStorage = require('./contracts/structArrayStorage')
var output = compiler.compile(structArrayStorage.contract, 0)
var decoded = stateDecoder.solidityState(structArrayStorage.storage, output.sources, 'structArrayStorage')
st.equal(decoded['intStructDec']['i8'], '32')
st.equal(decoded['intStructDec']['i16'], '-54')
st.equal(decoded['intStructDec']['ui32'], '128')
st.equal(decoded['intStructDec']['i256'], '-1243565465756')
st.equal(decoded['intStructDec']['ui16'], '34556')
st.equal(decoded['intStructDec']['i32'], '-345446546')
st.equal(decoded['intStructDec'].value['i8'].value, '32')
st.equal(decoded['intStructDec'].value['i16'].value, '-54')
st.equal(decoded['intStructDec'].value['ui32'].value, '128')
st.equal(decoded['intStructDec'].value['i256'].value, '-1243565465756')
st.equal(decoded['intStructDec'].value['ui16'].value, '34556')
st.equal(decoded['intStructDec'].value['i32'].value, '-345446546')
st.equal(decoded['i5'].length, '0x7')
st.equal(decoded['i5'].value[0], '-2134')
st.equal(decoded['i5'].value[1], '345')
st.equal(decoded['i5'].value[2], '-3246')
st.equal(decoded['i5'].value[3], '4357')
st.equal(decoded['i5'].value[4], '324')
st.equal(decoded['i5'].value[5], '-2344')
st.equal(decoded['i5'].value[6], '3254')
st.equal(decoded['i5'].value[0].value, '-2134')
st.equal(decoded['i5'].value[1].value, '345')
st.equal(decoded['i5'].value[2].value, '-3246')
st.equal(decoded['i5'].value[3].value, '4357')
st.equal(decoded['i5'].value[4].value, '324')
st.equal(decoded['i5'].value[5].value, '-2344')
st.equal(decoded['i5'].value[6].value, '3254')
st.equal(decoded['idyn5'].length, '0x9')
st.equal(decoded['idyn5'].value[0], '-2134')
st.equal(decoded['idyn5'].value[1], '345')
st.equal(decoded['idyn5'].value[2], '-3246')
st.equal(decoded['idyn5'].value[3], '4357')
st.equal(decoded['idyn5'].value[4], '324')
st.equal(decoded['idyn5'].value[5], '-2344')
st.equal(decoded['idyn5'].value[6], '3254')
st.equal(decoded['idyn5'].value[7], '-254')
st.equal(decoded['idyn5'].value[8], '-2354')
st.equal(decoded['idyn5'].value[0].value, '-2134')
st.equal(decoded['idyn5'].value[1].value, '345')
st.equal(decoded['idyn5'].value[2].value, '-3246')
st.equal(decoded['idyn5'].value[3].value, '4357')
st.equal(decoded['idyn5'].value[4].value, '324')
st.equal(decoded['idyn5'].value[5].value, '-2344')
st.equal(decoded['idyn5'].value[6].value, '3254')
st.equal(decoded['idyn5'].value[7].value, '-254')
st.equal(decoded['idyn5'].value[8].value, '-2354')
st.equal(decoded['dyn1'].length, '0x4')
st.equal(decoded['dyn1'].value[0].length, '0x1')
st.equal(decoded['dyn1'].value[0].value[0], '3')
st.equal(decoded['dyn1'].value[0].value[0].value, '3')
st.equal(decoded['dyn1'].value[1].length, '0x3')
st.equal(decoded['dyn1'].value[1].value[0], '12')
st.equal(decoded['dyn1'].value[1].value[1], '-12')
st.equal(decoded['dyn1'].value[1].value[2], '-1234')
st.equal(decoded['dyn1'].value[1].value[0].value, '12')
st.equal(decoded['dyn1'].value[1].value[1].value, '-12')
st.equal(decoded['dyn1'].value[1].value[2].value, '-1234')
st.equal(decoded['dyn1'].value[2].length, '0xa')
st.equal(decoded['dyn1'].value[2].value[0], '1')
st.equal(decoded['dyn1'].value[2].value[1], '12')
st.equal(decoded['dyn1'].value[2].value[2], '1235')
st.equal(decoded['dyn1'].value[2].value[3], '-12')
st.equal(decoded['dyn1'].value[2].value[4], '-123456')
st.equal(decoded['dyn1'].value[2].value[5], '-23435435')
st.equal(decoded['dyn1'].value[2].value[6], '543543')
st.equal(decoded['dyn1'].value[2].value[7], '2')
st.equal(decoded['dyn1'].value[2].value[8], '-1')
st.equal(decoded['dyn1'].value[2].value[9], '232432')
st.equal(decoded['dyn1'].value[2].value[0].value, '1')
st.equal(decoded['dyn1'].value[2].value[1].value, '12')
st.equal(decoded['dyn1'].value[2].value[2].value, '1235')
st.equal(decoded['dyn1'].value[2].value[3].value, '-12')
st.equal(decoded['dyn1'].value[2].value[4].value, '-123456')
st.equal(decoded['dyn1'].value[2].value[5].value, '-23435435')
st.equal(decoded['dyn1'].value[2].value[6].value, '543543')
st.equal(decoded['dyn1'].value[2].value[7].value, '2')
st.equal(decoded['dyn1'].value[2].value[8].value, '-1')
st.equal(decoded['dyn1'].value[2].value[9].value, '232432')
st.equal(decoded['dyn1'].value[3].length, '0x2')
st.equal(decoded['dyn1'].value[3].value[0], '232432')
st.equal(decoded['dyn1'].value[3].value[0], '232432')
st.equal(decoded['dyn1'].value[3].value[0].value, '232432')
st.equal(decoded['dyn1'].value[3].value[0].value, '232432')
st.equal(decoded['dyn2'].length, '0x2')
st.equal(decoded['dyn2'].value[0].length, '0x4')
st.equal(decoded['dyn2'].value[0].value[0].value[0], '23')
st.equal(decoded['dyn2'].value[0].value[0].value[1], '-23')
st.equal(decoded['dyn2'].value[0].value[0].value[2], '-28')
st.equal(decoded['dyn2'].value[0].value[1].value[0], '23')
st.equal(decoded['dyn2'].value[0].value[1].value[1], '-23')
st.equal(decoded['dyn2'].value[0].value[1].value[2], '-28')
st.equal(decoded['dyn2'].value[0].value[2].value[0], '23')
st.equal(decoded['dyn2'].value[0].value[2].value[1], '-23')
st.equal(decoded['dyn2'].value[0].value[2].value[2], '-28')
st.equal(decoded['dyn2'].value[0].value[3].value[0], '23')
st.equal(decoded['dyn2'].value[0].value[3].value[1], '-23')
st.equal(decoded['dyn2'].value[0].value[3].value[2], '-28')
st.equal(decoded['dyn2'].value[0].value[0].value[0].value, '23')
st.equal(decoded['dyn2'].value[0].value[0].value[1].value, '-23')
st.equal(decoded['dyn2'].value[0].value[0].value[2].value, '-28')
st.equal(decoded['dyn2'].value[0].value[1].value[0].value, '23')
st.equal(decoded['dyn2'].value[0].value[1].value[1].value, '-23')
st.equal(decoded['dyn2'].value[0].value[1].value[2].value, '-28')
st.equal(decoded['dyn2'].value[0].value[2].value[0].value, '23')
st.equal(decoded['dyn2'].value[0].value[2].value[1].value, '-23')
st.equal(decoded['dyn2'].value[0].value[2].value[2].value, '-28')
st.equal(decoded['dyn2'].value[0].value[3].value[0].value, '23')
st.equal(decoded['dyn2'].value[0].value[3].value[1].value, '-23')
st.equal(decoded['dyn2'].value[0].value[3].value[2].value, '-28')
st.equal(decoded['dyn2'].value[1].length, '0x4')
st.equal(decoded['dyn2'].value[1].value[0].value[0], '23')
st.equal(decoded['dyn2'].value[1].value[0].value[1], '-23')
st.equal(decoded['dyn2'].value[1].value[0].value[2], '-28')
st.equal(decoded['dyn2'].value[1].value[1].value[0], '23')
st.equal(decoded['dyn2'].value[1].value[1].value[1], '-23')
st.equal(decoded['dyn2'].value[1].value[1].value[2], '-28')
st.equal(decoded['dyn2'].value[1].value[2].value[0], '23')
st.equal(decoded['dyn2'].value[1].value[2].value[1], '-23')
st.equal(decoded['dyn2'].value[1].value[2].value[2], '-28')
st.equal(decoded['dyn2'].value[1].value[3].value[0], '23')
st.equal(decoded['dyn2'].value[1].value[3].value[1], '-23')
st.equal(decoded['dyn2'].value[1].value[3].value[2], '-28')
st.equal(decoded['arrayStruct'].value[0].value[0].i8, '34')
st.equal(decoded['arrayStruct'].value[0].value[0].str.value, 'test_str_short')
st.equal(decoded['arrayStruct'].value[0].value[1].i8, '-123')
st.equal(decoded['arrayStruct'].value[0].value[1].str.value, 'test_str_long test_str_lo ngtest_str_longtest_str_ longtest_str_longtest_ str_longtest_str_l ongtest_str_long')
st.equal(decoded['arrayStruct'].value[1].value[0].i8, '50')
st.equal(decoded['arrayStruct'].value[1].value[0].str.value, 'test_str_short')
st.equal(decoded['arrayStruct'].value[2].value[0].i8, '60')
st.equal(decoded['arrayStruct'].value[2].value[0].str.value, 'test_str_short')
st.equal(decoded['arrayStruct'].value[2].value[1].i8, '84')
st.equal(decoded['arrayStruct'].value[2].value[1].str.value, 'test_str_long test_str_lo ngtest_str_longtest_str_ longtest_str_longtest_ str_longtest_str_l ongtest_str_long')
st.equal(decoded['arrayStruct'].value[2].value[2].i8, '-34')
st.equal(decoded['arrayStruct'].value[2].value[2].str.value, 'test_str_short')
st.equal(decoded['dyn2'].value[1].value[0].value[0].value, '23')
st.equal(decoded['dyn2'].value[1].value[0].value[1].value, '-23')
st.equal(decoded['dyn2'].value[1].value[0].value[2].value, '-28')
st.equal(decoded['dyn2'].value[1].value[1].value[0].value, '23')
st.equal(decoded['dyn2'].value[1].value[1].value[1].value, '-23')
st.equal(decoded['dyn2'].value[1].value[1].value[2].value, '-28')
st.equal(decoded['dyn2'].value[1].value[2].value[0].value, '23')
st.equal(decoded['dyn2'].value[1].value[2].value[1].value, '-23')
st.equal(decoded['dyn2'].value[1].value[2].value[2].value, '-28')
st.equal(decoded['dyn2'].value[1].value[3].value[0].value, '23')
st.equal(decoded['dyn2'].value[1].value[3].value[1].value, '-23')
st.equal(decoded['dyn2'].value[1].value[3].value[2].value, '-28')
st.equal(decoded['arrayStruct'].value[0].value[0].value.i8.value, '34')
st.equal(decoded['arrayStruct'].value[0].value[0].value.str.value, 'test_str_short')
st.equal(decoded['arrayStruct'].value[0].value[1].value.i8.value, '-123')
st.equal(decoded['arrayStruct'].value[0].value[1].value.str.value, 'test_str_long test_str_lo ngtest_str_longtest_str_ longtest_str_longtest_ str_longtest_str_l ongtest_str_long')
st.equal(decoded['arrayStruct'].value[1].value[0].value.i8.value, '50')
st.equal(decoded['arrayStruct'].value[1].value[0].value.str.value, 'test_str_short')
st.equal(decoded['arrayStruct'].value[2].value[0].value.i8.value, '60')
st.equal(decoded['arrayStruct'].value[2].value[0].value.str.value, 'test_str_short')
st.equal(decoded['arrayStruct'].value[2].value[1].value.i8.value, '84')
st.equal(decoded['arrayStruct'].value[2].value[1].value.str.value, 'test_str_long test_str_lo ngtest_str_longtest_str_ longtest_str_longtest_ str_longtest_str_l ongtest_str_long')
st.equal(decoded['arrayStruct'].value[2].value[2].value.i8.value, '-34')
st.equal(decoded['arrayStruct'].value[2].value[2].value.str.value, 'test_str_short')
}

Loading…
Cancel
Save