* Add toU8a conversions * Add u8a utilities * @polkadot/rlp with encoding * Decoding test runthrough * Update util locations * Convert util-triehash to use util-rlp * Allow keccak from Uint8Array * Pass Uint8Array to keccak input * Update documentation * Skip some doc generation * Update @polkadot/dev * Update doc typo * Update allocations * Retrieve tests from ethereumjs-testing * Simplify test retrieval * Exclude etereumjs-testing from flow
21 lines
604 B
JavaScript
21 lines
604 B
JavaScript
// Copyright 2017-2018 Jaco Greeff
|
|
// This software may be modified and distributed under the terms
|
|
// of the ISC license. See the LICENSE file for details.
|
|
|
|
const BN = require('bn.js');
|
|
const { getSingleFile } = require('ethereumjs-testing');
|
|
|
|
const bnToU8a = require('@polkadot/util/bn/toU8a');
|
|
|
|
module.exports = function getTests (file) {
|
|
const tests = getSingleFile(file);
|
|
|
|
return Object.keys(tests).map((name) => ({
|
|
name,
|
|
input: tests[name].in[0] !== '#'
|
|
? tests[name].in
|
|
: bnToU8a(new BN(tests[name].in.slice(1))),
|
|
output: `0x${tests[name].out.toLowerCase()}`
|
|
}));
|
|
};
|