Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #61 from ethereumjs/remove-ethereumjs-testing
Browse files Browse the repository at this point in the history
Remove ethereumjs-testing dependency
  • Loading branch information
holgerd77 authored Dec 8, 2018
2 parents f255f80 + d61da4b commit f8dbba1
Show file tree
Hide file tree
Showing 6 changed files with 4,585 additions and 10 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"browserify": "^15.0.0",
"coveralls": "^2.11.6",
"documentation": "4.0.0-beta16",
"ethereumjs-testing": "~1.0.0",
"istanbul": "^0.4.2",
"karma": "^2.0.0",
"karma-browserify": "^5.1.0",
Expand Down
4,565 changes: 4,565 additions & 0 deletions tests/bcBlockGasLimitTest.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions tests/block.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const tape = require('tape')
const Common = require('ethereumjs-common')
const testing = require('ethereumjs-testing')
const rlp = require('ethereumjs-util').rlp
const Block = require('../index.js')

Expand Down Expand Up @@ -63,7 +62,7 @@ tape('[Block]: block functions', function (t) {
st.end()
})

const testDataGenesis = testing.getSingleFile('BasicTests/genesishashestest.json')
const testDataGenesis = require('./genesishashestest.json').test
t.test('should test genesis hashes (mainnet default)', function (st) {
var genesisBlock = new Block()
genesisBlock.setGenesisParams()
Expand Down
1 change: 0 additions & 1 deletion tests/difficulty.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// const testing = require('ethereumjs-testing')
const utils = require('ethereumjs-util')
const tape = require('tape')
const Block = require('../')
Expand Down
10 changes: 10 additions & 0 deletions tests/genesishashestest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"source": "https://github.com/ethereum/tests/blob/develop/BasicTests/genesishashestest.json",
"commit": "149cc9bbd338d7299435f97ba24ace0cd3f716de",
"date": "2018-12-07",
"test": {
"genesis_rlp_hex": "f90219f90214a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000850400000000808213888080a011bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82faa00000000000000000000000000000000000000000000000000000000000000000880000000000000042c0c0",
"genesis_state_root": "d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",
"genesis_hash": "d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"
}
}
15 changes: 9 additions & 6 deletions tests/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const tape = require('tape')
const Common = require('ethereumjs-common')
const utils = require('ethereumjs-util')
const rlp = utils.rlp
const testing = require('ethereumjs-testing')
const Header = require('../header.js')
const Block = require('../index.js')

Expand Down Expand Up @@ -49,11 +48,15 @@ tape('[Block]: Header functions', function (t) {
})

t.test('should test validateGasLimit', function (st) {
const testData = testing.getSingleFile('BlockchainTests/bcBlockGasLimitTest.json')
const testData = require('./bcBlockGasLimitTest.json').tests
const bcBlockGasLimigTestData = testData.BlockGasLimit2p63m1

Object.keys(bcBlockGasLimigTestData).forEach(key => {
var parentBlock = new Block(rlp.decode(bcBlockGasLimigTestData[key].genesisRLP))
var block = new Block(rlp.decode(bcBlockGasLimigTestData[key].blocks[0].rlp))
st.equal(block.header.validateGasLimit(parentBlock), true)
})

var parentBlock = new Block(rlp.decode(testData['BlockGasLimit2p63m1'].genesisRLP))
var block = new Block(rlp.decode(testData['BlockGasLimit2p63m1'].blocks[0].rlp))
st.equal(block.header.validateGasLimit(parentBlock), true)
st.end()
})

Expand All @@ -65,7 +68,7 @@ tape('[Block]: Header functions', function (t) {
st.end()
})

const testDataGenesis = testing.getSingleFile('BasicTests/genesishashestest.json')
const testDataGenesis = require('./genesishashestest.json').test
t.test('should test genesis hashes (mainnet default)', function (st) {
var header = new Header()
header.setGenesisParams()
Expand Down

0 comments on commit f8dbba1

Please sign in to comment.