Commit 41ed3e48 authored by yann300's avatar yann300

add tests

parent cf76ba27
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'config', 'get', 'prefix' ]
2 info using npm@3.8.6
3 info using node@v5.12.0
4 verbose exit [ 0, true ]
5 verbose stack Error: write EPIPE
5 verbose stack at exports._errnoException (util.js:893:11)
5 verbose stack at WriteWrap.afterWrite (net.js:783:14)
6 verbose cwd /home/yann/Ethereum/remix/fea1/remix
7 error Linux 3.16.0-30-generic
8 error argv "/usr/bin/nodejs" "/usr/bin/npm" "config" "get" "prefix"
9 error node v5.12.0
10 error npm v3.8.6
11 error code EPIPE
12 error errno EPIPE
13 error syscall write
14 error write EPIPE
15 error If you need help, you may report this error at:
15 error <https://github.com/npm/npm/issues>
16 verbose exit [ 1, true ]
...@@ -40,6 +40,7 @@ TraceAnalyser.prototype.buildReturnValues = function (index, step) { ...@@ -40,6 +40,7 @@ TraceAnalyser.prototype.buildReturnValues = function (index, step) {
var offset = 2 * parseInt(step.stack[step.stack.length - 1], 16) var offset = 2 * parseInt(step.stack[step.stack.length - 1], 16)
var size = 2 * parseInt(step.stack[step.stack.length - 2], 16) var size = 2 * parseInt(step.stack[step.stack.length - 2], 16)
var memory = this.trace[this.traceCache.memoryChanges[this.traceCache.memoryChanges.length - 1]].memory var memory = this.trace[this.traceCache.memoryChanges[this.traceCache.memoryChanges.length - 1]].memory
console.log('push returnValue ' + index)
this.traceCache.pushReturnValue(index, '0x' + memory.join('').substr(offset, size)) this.traceCache.pushReturnValue(index, '0x' + memory.join('').substr(offset, size))
} }
} }
......
...@@ -109,8 +109,9 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address ...@@ -109,8 +109,9 @@ TraceManager.prototype.getStorageAt = function (stepIndex, tx, callback, address
TraceManager.prototype.getAddresses = function (callback) { TraceManager.prototype.getAddresses = function (callback) {
var addresses = [ this.tx.to ] var addresses = [ this.tx.to ]
for (var k in this.traceCache.calls) { for (var k in this.traceCache.calls) {
if (this.traceCache.calls[k].address) { var address = this.traceCache.calls[k].address
addresses.push(this.traceCache.calls[k].address) if (address && addresses.join('').indexOf(address) === -1) {
addresses.push(address)
} }
} }
callback(null, addresses) callback(null, addresses)
......
...@@ -297,4 +297,27 @@ tape('TraceManager', function (t) { ...@@ -297,4 +297,27 @@ tape('TraceManager', function (t) {
st.ok(result === 63) st.ok(result === 63)
st.end() st.end()
}) })
t.test('TraceManager.getAddresses', function (st) {
traceManager.getAddresses(function (error, result) {
if (error) {
st.fail(error)
} else {
st.ok(result[0] === '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
st.ok(result[1] === '(Contract Creation - Step 63)')
st.end()
}
})
})
t.test('TraceManager.getReturnValue', function (st) {
traceManager.getReturnValue(108, function (error, result) {
if (error) {
st.fail(error)
} else {
st.ok(result === '0x60606040526008565b00')
st.end()
}
})
})
}) })
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