Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Add tests for constants value #178

Merged
merged 1 commit into from
Feb 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,50 @@ const ethUtils = require('../dist/index.js')
const BN = require('bn.js')
const eip1014Testdata = require('./testdata/eip1014Examples.json')

describe('constants', function() {
it('should match constants', function () {
assert.equal(
ethUtils.MAX_INTEGER.toString('hex'),
'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
)

assert.equal(
ethUtils.TWO_POW256.toString('hex'),
'10000000000000000000000000000000000000000000000000000000000000000'
)

assert.equal(
ethUtils.KECCAK256_NULL_S,
'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
)

assert.equal(
ethUtils.KECCAK256_NULL.toString('hex'),
'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
)

assert.equal(
ethUtils.KECCAK256_RLP_ARRAY_S,
'1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
)

assert.equal(
ethUtils.KECCAK256_RLP_ARRAY.toString('hex'),
'1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
)

assert.equal(
ethUtils.KECCAK256_RLP_S,
'56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
)

assert.equal(
ethUtils.KECCAK256_RLP.toString('hex'),
'56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
)
})
})

describe('zeros function', function () {
it('should produce lots of 0s', function () {
const z60 = ethUtils.zeros(30)
Expand Down