Commit e5250839 authored by yann300's avatar yann300

add test

parent ce64772d
'use strict' 'use strict'
var tape = require('tape') var tape = require('tape')
var txFormat = require('../src/execution/txFormat') var txFormat = require('../src/execution/txFormat')
var txHelper = require('../src/execution/txHelper')
var compiler = require('solc') var compiler = require('solc')
var compilerInput = require('../src/helpers/compilerHelper').compilerInput var compilerInput = require('../src/helpers/compilerHelper').compilerInput
var executionContext = require('../src/execution/execution-context') var executionContext = require('../src/execution/execution-context')
...@@ -149,6 +150,17 @@ function encodeFunctionCallTest (st) { ...@@ -149,6 +150,17 @@ function encodeFunctionCallTest (st) {
/* *********************************************************** */ /* *********************************************************** */
tape('test fallback function', function (t) {
t.test('(fallback)', function (st) {
st.plan(2)
var output = compiler.compileStandardWrapper(compilerInput(fallbackFunction))
output = JSON.parse(output)
var contract = output.contracts['test.sol']['fallbackFunctionContract']
st.equal(txHelper.encodeFunctionId(contract.abi[0]), '0x805da4ad')
st.equal(txHelper.encodeFunctionId(contract.abi[1]), '0x')
})
})
var uintContract = `contract uintContractTest { var uintContract = `contract uintContractTest {
uint _tp; uint _tp;
address _ap; address _ap;
...@@ -186,3 +198,13 @@ contract testContractLinkLibrary { ...@@ -186,3 +198,13 @@ contract testContractLinkLibrary {
} }
}` }`
var fallbackFunction = `pragma solidity ^0.4.4;
contract fallbackFunctionContract {
function get (uint _p, string _o) {
}
function () {}
}`
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