remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/libs/remix-debug/test/decoder/localDecoder.ts

77 lines
3.2 KiB

8 years ago
'use strict'
import tape from 'tape'
2 years ago
import { CompilerAbstract } from '@remix-project/remix-solidity'
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const compiler = require('solc')
const intLocal = require('./contracts/intLocal')
const miscLocal = require('./contracts/miscLocal')
const structArrayLocal = require('./contracts/structArrayLocal')
const calldataLocal = require('./contracts/calldata')
const vmCall = require('../vmCall')
const intLocalTest = require('./localsTests/int')
const miscLocalTest = require('./localsTests/misc')
const misc2LocalTest = require('./localsTests/misc2')
const structArrayLocalTest = require('./localsTests/structArray')
const calldataLocalTest = require('./localsTests/calldata')
const compilerInput = require('../helpers/compilerHelper').compilerInput
8 years ago
tape('solidity', function (t) {
t.test('local decoder', async function (st) {
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
const privateKey = Buffer.from('503f38a9c967ed597e47fe25643985f032b072db8075426a92110f82df48dfcb', 'hex')
await test(st, privateKey)
8 years ago
})
})
async function test (st, privateKey) {
# This is a combination of 50 commits. # This is the 1st commit message: executors # This is the commit message #2: libs # This is the commit message #3: remixd # This is the commit message #4: add react app # This is the commit message #5: debugging # This is the commit message #6: debug + sol # This is the commit message #7: fixes # This is the commit message #8: tsconfig # This is the commit message #9: ast walker # This is the commit message #10: as walker # This is the commit message #11: remixd etc # This is the commit message #12: commander # This is the commit message #13: remove jest # This is the commit message #14: rm ui files # This is the commit message #15: rm reserved keywords # This is the commit message #16: testrunner # This is the commit message #17: compiler # This is the commit message #18: production build # This is the commit message #19: config # This is the commit message #20: config # This is the commit message #21: web types # This is the commit message #22: update react # This is the commit message #23: add vm # This is the commit message #24: add workers # This is the commit message #25: worker2 # This is the commit message #26: rm react app # This is the commit message #27: remixd # This is the commit message #28: worker fix # This is the commit message #29: fix detection # This is the commit message #30: revert react # This is the commit message #31: rename type # This is the commit message #32: loading handler # This is the commit message #33: remove import # This is the commit message #34: rename # This is the commit message #35: local plugin # This is the commit message #36: etherscan # This is the commit message #37: revert react # This is the commit message #38: port # This is the commit message #39: rm worker # This is the commit message #40: publicpath # This is the commit message #41: fix test # This is the commit message #42: 112 # This is the commit message #43: show version # This is the commit message #44: "axios": "1.1.2", # This is the commit message #45: config # This is the commit message #46: lint # This is the commit message #47: fix build # This is the commit message #48: lint # This is the commit message #49: error on purpose # This is the commit message #50: test error
2 years ago
let output = compiler.compile(compilerInput(intLocal.contract))
output = JSON.parse(output)
2 years ago
let sources = {
target: 'test.sol',
sources: { 'test.sol': { content: intLocal.contract } }
}
let compilationResults = new CompilerAbstract('json', output, sources)
console.log('intLocalTest')
await intLocalTest(st, privateKey, output.contracts['test.sol']['intLocal'].evm.bytecode.object, compilationResults, intLocal.contract)
4 years ago
output = compiler.compile(compilerInput(miscLocal.contract))
output = JSON.parse(output)
2 years ago
sources = {
target: 'test.sol',
sources: { 'test.sol': { content: miscLocal.contract } }
}
compilationResults = new CompilerAbstract('json', output, sources)
console.log('miscLocalTest')
await miscLocalTest(st, privateKey, output.contracts['test.sol']['miscLocal'].evm.bytecode.object, compilationResults, miscLocal.contract)
4 years ago
output = compiler.compile(compilerInput(miscLocal.contract))
output = JSON.parse(output)
2 years ago
sources = {
target: 'test.sol',
sources: { 'test.sol': { content: miscLocal.contract } }
}
compilationResults = new CompilerAbstract('json', output, sources)
console.log('misc2LocalTest')
await misc2LocalTest(st, privateKey, output.contracts['test.sol']['miscLocal2'].evm.bytecode.object, compilationResults, miscLocal.contract)
4 years ago
output = compiler.compile(compilerInput(structArrayLocal.contract))
output = JSON.parse(output)
2 years ago
sources = {
target: 'test.sol',
sources: { 'test.sol': { content: structArrayLocal.contract } }
}
compilationResults = new CompilerAbstract('json', output, sources)
console.log('structArrayLocalTest')
await structArrayLocalTest(st, privateKey, output.contracts['test.sol']['structArrayLocal'].evm.bytecode.object, compilationResults, structArrayLocal.contract)
4 years ago
output = compiler.compile(compilerInput(calldataLocal.contract))
output = JSON.parse(output)
2 years ago
sources = {
target: 'test.sol',
sources: { 'test.sol': { content: calldataLocal.contract } }
}
compilationResults = new CompilerAbstract('json', output, sources)
console.log('calldataLocalTest')
await calldataLocalTest(st, privateKey, output.contracts['test.sol']['calldataLocal'].evm.bytecode.object, compilationResults, calldataLocal.contract)
4 years ago
st.end()
8 years ago
}