diff options
author | Gav Wood <i@gavwood.com> | 2015-01-12 01:16:50 +0800 |
---|---|---|
committer | Gav Wood <i@gavwood.com> | 2015-01-12 01:16:50 +0800 |
commit | dcf362c0d5ca53dd8f41afafcd8ce2a45f38c594 (patch) | |
tree | 79b9900b7a8c4013808ad8272abdb92d394c7b11 | |
download | dexon-solidity-dcf362c0d5ca53dd8f41afafcd8ce2a45f38c594.tar.gz dexon-solidity-dcf362c0d5ca53dd8f41afafcd8ce2a45f38c594.tar.zst dexon-solidity-dcf362c0d5ca53dd8f41afafcd8ce2a45f38c594.zip |
Squashed 'libjsqrc/ethereumjs/' changes from 47687cf..ab745d3
ab745d3 updated readme
b915c7a updated readme
6c26255 Merge branch 'tests' into develop
e2c4525 Merge branch 'master' into develop
e778e12 spec reporter instead of nyan
a4e6f0b fixed travis.yml && added nmp test script
048e777 Merge branch 'master' into tests
15c2293 updated package json
24814a4 Merge branch 'master' of https://github.com/ethereum/ethereum.js
6188e64 Update README.md
c34b0c6 Update README.md
29c60c0 Merge branch 'develop' into tests
b3eda29 Merge branch 'master' into tests
c397e35 mocha opts file && init of parser tests
b6058a8 methods existance tests in progress
5518022 mocha test init
git-subtree-dir: libjsqrc/ethereumjs
git-subtree-split: ab745d3b0eb89d67db1ed953020c665be3d072ed
-rw-r--r-- | abi.parsers.js | 37 | ||||
-rw-r--r-- | db.methods.js | 18 | ||||
-rw-r--r-- | eth.methods.js | 42 | ||||
-rw-r--r-- | mocha.opts | 2 | ||||
-rw-r--r-- | shh.methods.js | 19 | ||||
-rw-r--r-- | utils.js | 15 | ||||
-rw-r--r-- | web3.methods.js | 18 |
7 files changed, 151 insertions, 0 deletions
diff --git a/abi.parsers.js b/abi.parsers.js new file mode 100644 index 00000000..06a77fb8 --- /dev/null +++ b/abi.parsers.js @@ -0,0 +1,37 @@ +var assert = require('assert'); +var abi = require('../lib/abi.js'); + +describe('abi', function() { + describe('inputParser', function() { + it('should parse ...', function() { + + var desc = [{ + "name": "multiply", + "inputs": [ + { + "name": "a", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "d", + "type": "uint256" + } + ] + }]; + + var iParser = abi.inputParser(desc); + assert.equal(iParser.multiply(1), "0x000000000000000000000000000000000000000000000000000000000000000001"); + + }); + }); + + + describe('outputParser', function() { + it('parse ...', function() { + + }); + }); +}); + diff --git a/db.methods.js b/db.methods.js new file mode 100644 index 00000000..b4abfc4d --- /dev/null +++ b/db.methods.js @@ -0,0 +1,18 @@ +require('es6-promise').polyfill(); + +var assert = require('assert'); +var web3 = require('../index.js'); +var u = require('./utils.js'); +web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider + +describe('web3', function() { + describe('db', function() { + it('should have all methods implemented', function() { + u.methodExists(web3.db, 'put'); + u.methodExists(web3.db, 'get'); + u.methodExists(web3.db, 'putString'); + u.methodExists(web3.db, 'getString'); + }); + }); +}); + diff --git a/eth.methods.js b/eth.methods.js new file mode 100644 index 00000000..7190b27d --- /dev/null +++ b/eth.methods.js @@ -0,0 +1,42 @@ +require('es6-promise').polyfill(); + +var assert = require('assert'); +var web3 = require('../index.js'); +var u = require('./utils.js'); +web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider + +describe('web3', function() { + describe('eth', function() { + it('should have all methods implemented', function() { + u.methodExists(web3.eth, 'balanceAt'); + u.methodExists(web3.eth, 'stateAt'); + u.methodExists(web3.eth, 'storageAt'); + u.methodExists(web3.eth, 'countAt'); + u.methodExists(web3.eth, 'codeAt'); + u.methodExists(web3.eth, 'transact'); + u.methodExists(web3.eth, 'call'); + u.methodExists(web3.eth, 'block'); + u.methodExists(web3.eth, 'transaction'); + u.methodExists(web3.eth, 'uncle'); + u.methodExists(web3.eth, 'compilers'); + u.methodExists(web3.eth, 'lll'); + u.methodExists(web3.eth, 'solidity'); + u.methodExists(web3.eth, 'serpent'); + u.methodExists(web3.eth, 'logs'); + }); + + it('should have all properties implemented', function () { + u.propertyExists(web3.eth, 'coinbase'); + u.propertyExists(web3.eth, 'listening'); + u.propertyExists(web3.eth, 'mining'); + u.propertyExists(web3.eth, 'gasPrice'); + u.propertyExists(web3.eth, 'account'); + u.propertyExists(web3.eth, 'accounts'); + u.propertyExists(web3.eth, 'peerCount'); + u.propertyExists(web3.eth, 'defaultBlock'); + u.propertyExists(web3.eth, 'number'); + }); + }); +}); + + diff --git a/mocha.opts b/mocha.opts new file mode 100644 index 00000000..b2db8d5a --- /dev/null +++ b/mocha.opts @@ -0,0 +1,2 @@ +--reporter Spec + diff --git a/shh.methods.js b/shh.methods.js new file mode 100644 index 00000000..08f573a3 --- /dev/null +++ b/shh.methods.js @@ -0,0 +1,19 @@ +require('es6-promise').polyfill(); + +var assert = require('assert'); +var web3 = require('../index.js'); +var u = require('./utils.js'); +web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider + +describe('web3', function() { + describe('shh', function() { + it('should have all methods implemented', function() { + u.methodExists(web3.shh, 'post'); + u.methodExists(web3.shh, 'newIdentity'); + u.methodExists(web3.shh, 'haveIdentity'); + u.methodExists(web3.shh, 'newGroup'); + u.methodExists(web3.shh, 'addToGroup'); + }); + }); +}); + diff --git a/utils.js b/utils.js new file mode 100644 index 00000000..4c508da6 --- /dev/null +++ b/utils.js @@ -0,0 +1,15 @@ +var assert = require('assert'); + +var methodExists = function (object, method) { + assert.equal('function', typeof object[method], 'method ' + method + ' is not implemented'); +}; + +var propertyExists = function (object, property) { + assert.equal('object', typeof object[property], 'property ' + property + ' is not implemented'); +}; + +module.exports = { + methodExists: methodExists, + propertyExists: propertyExists +}; + diff --git a/web3.methods.js b/web3.methods.js new file mode 100644 index 00000000..a7e02097 --- /dev/null +++ b/web3.methods.js @@ -0,0 +1,18 @@ +require('es6-promise').polyfill(); + +var assert = require('assert'); +var web3 = require('../index.js'); +var u = require('./utils.js'); +web3.setProvider(new web3.providers.WebSocketProvider('http://localhost:8080')); // TODO: create some mock provider + +describe('web3', function() { + it('should have all methods implemented', function() { + u.methodExists(web3, 'sha3'); + u.methodExists(web3, 'toAscii'); + u.methodExists(web3, 'fromAscii'); + u.methodExists(web3, 'toFixed'); + u.methodExists(web3, 'fromFixed'); + u.methodExists(web3, 'offset'); + }); +}); + |